Partager via


ObjectContent<T> Class

Generic form of ObjectContent.

Inheritance Hierarchy

System.Object
  HttpContent
    System.Net.Http.ObjectContent
      System.Net.Http.ObjectContent<T>

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

Syntax

'Declaration
Public Class ObjectContent(Of T) _
    Inherits ObjectContent
'Usage
Dim instance As ObjectContent(Of T)
public class ObjectContent<T> : ObjectContent
generic<typename T>
public ref class ObjectContent : public ObjectContent
type ObjectContent<'T> =  
    class
        inherit ObjectContent
    end
JScript does not support generic types and methods.

Type Parameters

  • T
    The type of object this class will contain.

The ObjectContent<T> type exposes the following members.

Constructors

  Name Description
Public method ObjectContent<T>(T, MediaTypeFormatter) Initializes a new instance of the ObjectContent<T> class.
Public method ObjectContent<T>(T, MediaTypeFormatter, MediaTypeHeaderValue) Initializes a new instance of the <see cref="T:System.Net.Http.ObjectContent`1" /> class.
Public method ObjectContent<T>(T, MediaTypeFormatter, String) Initializes a new instance of the ObjectContent<T> class.

Top

Properties

  Name Description
Public property Formatter Gets the media-type formatter associated with this content instance. (Inherited from ObjectContent.)
Public property Headers (Inherited from HttpContent.)
Public property ObjectType Gets the type of object managed by this ObjectContent instance. (Inherited from ObjectContent.)
Public property Value Gets or sets the value of the content. (Inherited from ObjectContent.)

Top

Methods

  Name Description
Public method CopyToAsync(Stream) (Inherited from HttpContent.)
Public method CopyToAsync(Stream, TransportContext) (Inherited from HttpContent.)
Protected method CreateContentReadStreamAsync (Inherited from HttpContent.)
Public method Dispose() (Inherited from HttpContent.)
Protected method Dispose(Boolean) (Inherited from HttpContent.)
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Public method LoadIntoBufferAsync() (Inherited from HttpContent.)
Public method LoadIntoBufferAsync(Int64) (Inherited from HttpContent.)
Protected method MemberwiseClone (Inherited from Object.)
Public method ReadAsByteArrayAsync (Inherited from HttpContent.)
Public method ReadAsStreamAsync (Inherited from HttpContent.)
Public method ReadAsStringAsync (Inherited from HttpContent.)
Protected method SerializeToStreamAsync Asynchronously serializes the object's content to the given stream. (Inherited from ObjectContent.)
Public method ToString (Inherited from Object.)
Protected method TryComputeLength Computes the length of the stream if possible. (Inherited from ObjectContent.)

Top

Extension Methods

  Name Description
Public Extension Method IsFormData Determines whether the specified content is HTML form URL-encoded data. (Defined by HttpContentFormDataExtensions.)
Public Extension Method IsHttpRequestMessageContent Determines whether the specified content is HTTP request message content. (Defined by HttpContentMessageExtensions.)
Public Extension Method IsHttpResponseMessageContent Determines whether the specified content is HTTP response message content. (Defined by HttpContentMessageExtensions.)
Public Extension Method IsMimeMultipartContent() Overloaded. Determines whether the specified content is MIME multipart content. (Defined by HttpContentMultipartExtensions.)
Public Extension Method IsMimeMultipartContent(String) Overloaded. Determines whether the specified content is MIME multipart content with the specified subtype. (Defined by HttpContentMultipartExtensions.)
Public Extension Method ReadAsAsync(Type) Overloaded. Returns a Task that will yield an object of the specified type from the content instance. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsAsync(Type, IEnumerable<MediaTypeFormatter>) Overloaded. Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsAsync(Type, IEnumerable<MediaTypeFormatter>, IFormatterLogger) Overloaded. Returns a Task that will yield an object of the specified type from the content instance using one of the provided formatters to deserialize the content. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsAsync<T>() Overloaded. Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsAsync<T>(IEnumerable<MediaTypeFormatter>) Overloaded. Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsAsync<T>(IEnumerable<MediaTypeFormatter>, IFormatterLogger) Overloaded. Returns a Task that will yield an object of the specified type <typeparamref name="T" /> from the content instance. (Defined by HttpContentExtensions.)
Public Extension Method ReadAsFormDataAsync Asynchronously reads HTML form URL-encoded from an HttpContent instance and stores the results in a NameValueCollection object. (Defined by HttpContentFormDataExtensions.)
Public Extension Method ReadAsHttpRequestMessageAsync() Overloaded. Reads the HttpContent as an HttpRequestMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpRequestMessageAsync(String) Overloaded. Reads the HttpContent as an HttpRequestMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpRequestMessageAsync(String, Int32) Overloaded. Reads the HttpContent as an HttpRequestMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpRequestMessageAsync(String, Int32, Int32) Overloaded. Reads the HttpContent as an HttpRequestMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpResponseMessageAsync() Overloaded. Reads the HttpContent as an HttpResponseMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpResponseMessageAsync(Int32) Overloaded. Reads the HttpContent as an HttpResponseMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsHttpResponseMessageAsync(Int32, Int32) Overloaded. Reads the HttpContent as an HttpResponseMessage. (Defined by HttpContentMessageExtensions.)
Public Extension Method ReadAsMultipartAsync() Overloaded. Reads all body parts within a MIME multipart message and produces a set of HttpContent instances as a result. (Defined by HttpContentMultipartExtensions.)
Public Extension Method ReadAsMultipartAsync<T>(T) Overloaded. Reads all body parts within a MIME multipart message and produces a set of HttpContent instances as a result using the streamProvider instance to determine where the contents of each body part is written. (Defined by HttpContentMultipartExtensions.)
Public Extension Method ReadAsMultipartAsync<T>(T, Int32) Overloaded. Reads all body parts within a MIME multipart message and produces a set of HttpContent instances as a result using the streamProvider instance to determine where the contents of each body part is written and bufferSize as read buffer size. (Defined by HttpContentMultipartExtensions.)

Top

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 Namespace