Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Net.​Http.​HttpContent

Assembly: System.Net.Http

Inheritance: object → HttpContent

Implemented Interfaces

A base class representing an HTTP entity body and content headers.

Properties

Headers
Gets the HTTP content headers as defined in RFC 2616.

Methods

public void
CopyTo​(IO.​Stream stream, TransportContext? context, Threading.​CancellationToken cancellationToken)
Serializes the HTTP content into a stream of bytes and copies it to <paramref name="stream" /> .
stream The target stream.
context Information about the transport (for example, the channel binding token). This parameter may be <see langword="null" /> .
cancellationToken The cancellation token to cancel the operation.
CopyToAsync​(IO.​Stream stream)
Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the <paramref name="stream" /> parameter.
Returns The task object representing the asynchronous operation.
stream The target stream.
CopyToAsync​(IO.​Stream stream, TransportContext? context)
Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the <paramref name="stream" /> parameter.
Returns The task object representing the asynchronous operation.
stream The target stream.
context Information about the transport (channel binding token, for example). This parameter may be <see langword="null" /> .
CopyToAsync​(IO.​Stream stream, TransportContext? context, Threading.​CancellationToken cancellationToken)
Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the <paramref name="stream" /> parameter.
Returns The task object representing the asynchronous operation.
stream The target stream.
context Information about the transport (channel binding token, for example). This parameter may be <see langword="null" /> .
cancellationToken The cancellation token to cancel the operation.
CopyToAsync​(IO.​Stream stream, Threading.​CancellationToken cancellationToken)
Serialize the HTTP content into a stream of bytes and copies it to the stream object provided as the <paramref name="stream" /> parameter.
Returns The task object representing the asynchronous operation.
stream The target stream.
cancellationToken The cancellation token to cancel the operation.
protected IO.​Stream
CreateContentReadStream​(Threading.​CancellationToken cancellationToken)
Serializes the HTTP content to a memory stream.
Returns The output memory stream which contains the serialized HTTP content.
cancellationToken The cancellation token to cancel the operation.
CreateContentReadStreamAsync​()
Serialize the HTTP content to a memory stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
CreateContentReadStreamAsync​(Threading.​CancellationToken cancellationToken)
Serializes the HTTP content to a memory stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken The cancellation token to cancel the operation.
public void
Dispose​()
Releases the unmanaged resources and disposes of the managed resources used by the <see cref="T:System.Net.Http.HttpContent" /> .
protected void
Dispose​(bool disposing)
Releases the unmanaged resources used by the <see cref="T:System.Net.Http.HttpContent" /> and optionally disposes of the managed resources.
disposing <see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to releases only unmanaged resources.
LoadIntoBufferAsync​()
Serialize the HTTP content to a memory buffer as an asynchronous operation.
Returns The task object representing the asynchronous operation.
LoadIntoBufferAsync​(Threading.​CancellationToken cancellationToken)
Serialize the HTTP content to a memory buffer as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken The cancellation token to cancel the operation.
LoadIntoBufferAsync​(long maxBufferSize)
Serialize the HTTP content to a memory buffer as an asynchronous operation.
Returns The task object representing the asynchronous operation.
maxBufferSize The maximum size, in bytes, of the buffer to use.
LoadIntoBufferAsync​(long maxBufferSize, Threading.​CancellationToken cancellationToken)
Serialize the HTTP content to a memory buffer as an asynchronous operation.
Returns The task object representing the asynchronous operation.
maxBufferSize The maximum size, in bytes, of the buffer to use.
cancellationToken The cancellation token to cancel the operation.
public Threading.​Tasks.​Task<​byte[]>
ReadAsByteArrayAsync​()
Serialize the HTTP content to a byte array as an asynchronous operation.
Returns The task object representing the asynchronous operation.
public Threading.​Tasks.​Task<​byte[]>
ReadAsByteArrayAsync​(Threading.​CancellationToken cancellationToken)
Serialize the HTTP content to a byte array as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken The cancellation token to cancel the operation.
public IO.​Stream
ReadAsStream​()
Serializes the HTTP content and returns a stream that represents the content.
Returns The stream that represents the HTTP content.
public IO.​Stream
ReadAsStream​(Threading.​CancellationToken cancellationToken)
Serializes the HTTP content and returns a stream that represents the content.
Returns The stream that represents the HTTP content.
cancellationToken The cancellation token to cancel the operation.
ReadAsStreamAsync​()
Serialize the HTTP content and return a stream that represents the content as an asynchronous operation.
Returns The task object representing the asynchronous operation.
ReadAsStreamAsync​(Threading.​CancellationToken cancellationToken)
Serialize the HTTP content and return a stream that represents the content as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken The cancellation token to cancel the operation.
public Threading.​Tasks.​Task<​string>
ReadAsStringAsync​()
Serialize the HTTP content to a string as an asynchronous operation.
Returns The task object representing the asynchronous operation.
public Threading.​Tasks.​Task<​string>
ReadAsStringAsync​(Threading.​CancellationToken cancellationToken)
Serialize the HTTP content to a string as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken The cancellation token to cancel the operation.
protected void
SerializeToStream​(IO.​Stream stream, TransportContext? context, Threading.​CancellationToken cancellationToken)
When overridden in a derived class, serializes the HTTP content to a stream. Otherwise, throws a <see cref="T:System.NotSupportedException" /> .
stream The target stream.
context Information about the transport (for example, the channel binding token). This parameter may be <see langword="null" /> .
cancellationToken The cancellation token to cancel the operation.
SerializeToStreamAsync​(IO.​Stream stream, TransportContext? context)
Serialize the HTTP content to a stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
stream The target stream.
context Information about the transport (channel binding token, for example). This parameter may be <see langword="null" /> .
SerializeToStreamAsync​(IO.​Stream stream, TransportContext? context, Threading.​CancellationToken cancellationToken)
Serialize the HTTP content to a stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
stream The target stream.
context Information about the transport (channel binding token, for example). This parameter may be <see langword="null" /> .
cancellationToken The cancellation token to cancel the operation.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object