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
payloadobjectThe object to be serialized into XML format.
Exceptions
- ArgumentNullException
Thrown if
payloadis 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
contentobjectThe object to be serialized into XML format.
encodingEncodingThe character encoding to use for the serialized XML content.
Exceptions
- ArgumentNullException
Thrown if
contentorencodingis 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
streamStreamcontextTransportContext
Returns
TryComputeLength(out long)
protected override bool TryComputeLength(out long length)
Parameters
lengthlong