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
objectThe 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
objectThe object to be serialized into XML format.
encoding
EncodingThe character encoding to use for the serialized XML content.
Exceptions
- ArgumentNullException
Thrown if
content
orencoding
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
Streamcontext
TransportContext
Returns
TryComputeLength(out long)
protected override bool TryComputeLength(out long length)
Parameters
length
long