FormatterContext Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The context used to identify the HttpRequestMessage or HttpResponseMessage that needs to be either read or written.

Inheritance Hierarchy

System.Object
  System.Net.Http.Formatting.FormatterContext

Namespace:  System.Net.Http.Formatting
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
Public NotInheritable Class FormatterContext
public sealed class FormatterContext
public ref class FormatterContext sealed
[<Sealed>]
type FormatterContext =  class end
public final class FormatterContext

The FormatterContext type exposes the following members.

Constructors

  Name Description
Public method FormatterContext(HttpRequestMessage, Boolean) Instantiates a new instance of the FormatterContext class to use to serialize or deserialize a request.
Public method FormatterContext(HttpResponseMessage, Boolean) Instantiates a new instance of the FormatterContext class to use to serialize or deserialize a response.
Public method FormatterContext(MediaTypeHeaderValue, Boolean) Instantiates a new instance of a FormatterContext.

Top

Properties

  Name Description
Public property ContentType Gets the HTTP Content-Type of the request or response associated with the context.
Public property IsRead Gets a value indicating whether the context will be used to select for formatter for reading or writing the content
Public property Request Gets the HttpRequestMessage associated with the context.
Public property Response Gets the HttpResponseMessage associated with the context or null if there is no associated response message.

Top

Methods

  Name Description
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Remarks

Either Request or Response will be set, but not both. Whichever is set is the message to be read or written, according to the value of IsRead. In situations where neither a request or response is available, ContentType contains the raw content type.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Net.Http.Formatting Namespace