XmlContentSerializer.ToHttpContent(T) method¶
Defined in
Type: XmlContentSerializer
Namespace: Refit
Assembly: Refit.Xml.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, net462, net481, net471
Attributes: [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode", Justification = "Refit's XML serialization uses System.Xml.Serialization reflection that trimming cannot statically preserve. Use the Refit source generator for trimmed/AOT apps.")] [UnconditionalSuppressMessage("AOT", "IL3050:RequiresDynamicCode", Justification = "Refit's XML serialization may generate serialization assemblies at runtime. Use the Refit source generator for AOT apps.")]
public HttpContent ToHttpContent<T>(T item)
Summary: Serialize object of type T to a HttpContent with Xml.
Type parameters
| Name | Description |
|---|---|
T | Type of the object to serialize from. |
Parameters
| Name | Type | Description |
|---|---|---|
item | T | Object to serialize. |
Returns: HttpContent -- HttpContent that contains the serialized T object in Xml.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | Thrown when item is null. |