Table of Contents

Class XmlContent

Namespace
Kampute.HttpClient.Xml
Assembly
Kampute.HttpClient.Xml.dll

Represents HTTP content based on XML serialized from an object.

public sealed class XmlContent : HttpContent, IDisposable
Inheritance
XmlContent
Implements
Inherited Members
Extension Methods

Constructors

XmlContent(object)

Initializes a new instance of the XmlContent class using a specified content object with UTF-8 encoding.

public XmlContent(object payload)

Parameters

payload object

The object to be serialized into XML format.

Exceptions

ArgumentNullException

Thrown if payload is null.

XmlContent(object, Encoding)

Initializes a new instance of the XmlContent class using a specified content object and encoding.

public XmlContent(object content, Encoding encoding)

Parameters

content object

The object to be serialized into XML format.

encoding Encoding

The character encoding to use for the serialized XML content.

Exceptions

ArgumentNullException

Thrown if content or encoding is null.

Properties

Encoding

Gets the character encoding of the serialized XML content.

public Encoding Encoding { get; }

Property Value

Encoding

The character encoding of the serialized XML content.

Methods

SerializeToStreamAsync(Stream, TransportContext)

protected override Task SerializeToStreamAsync(Stream stream, TransportContext context)

Parameters

stream Stream
context TransportContext

Returns

Task

TryComputeLength(out long)

protected override bool TryComputeLength(out long length)

Parameters

length long

Returns

bool