IMediaTypeFormatter
Ecng.Net
Abstracts HTTP content serialization and deserialization for REST API clients.
Eigenschaften
MediaType
public string MediaType { get; }
value = iMediaTypeFormatter.MediaType
Gets the media type this formatter handles (e.g. "application/json").
Methoden
DeserializeAsync``1
public Task<T> DeserializeAsync<T>(HttpContent content, CancellationToken cancellationToken)
result = iMediaTypeFormatter.DeserializeAsync(content, cancellationToken)
Deserializes the HTTP content into an instance of .
- content
- The HTTP content to deserialize.
- cancellationToken
- A cancellation token.
Rückgabe: A task representing the deserialized value.
Serialize
public HttpContent Serialize(object value)
result = iMediaTypeFormatter.Serialize(value)
Serializes the specified value into HttpContent.
- value
- The value to serialize.
Rückgabe: The serialized HTTP content.