Skip to content

XmlContentSerializer.FromHttpContentAsync(HttpContent, CancellationToken) 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 Task<T?> FromHttpContentAsync<T>(HttpContent content, CancellationToken cancellationToken = default(CancellationToken))

Summary: Deserializes an object of type T from a HttpContent object that contains Xml content.

Type parameters

NameDescription
TType of the object to deserialize to.

Parameters

NameTypeDescription
contentHttpContentHttpContent object with Xml content to deserialize.
cancellationToken = nullCancellationTokenCancellationToken to abort the deserialization.

Returns: Task -- The deserialized object of type T.