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.​StringContent
Assembly: System.Net.Http
Inheritance: object → HttpContent → ByteArrayContent → StringContent
Implemented Interfaces
- IDisposable Implemented by: HttpContent
Provides HTTP content based on a string.
Properties
public
HttpContentHeaders
Headers
Gets the HTTP content headers as defined in RFC 2616.
Methods
SerializeToStreamAsync​(IO.​Stream stream,
TransportContext? context,
Threading.​CancellationToken cancellationToken)
Serialize and write the string provided in the constructor to an HTTP content stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
stream
The target stream.
context
Information about the transport, like channel binding token. This parameter may be <see langword="null" /> .
cancellationToken
The cancellation token to cancel the operation.
protected
IO.​Stream
CreateContentReadStream​(Threading.​CancellationToken cancellationToken)
Inherited from ByteArrayContent
Creates an HTTP content stream for reading. It uses the memory from the <see cref="T:System.Net.Http.ByteArrayContent" /> as a backing store.
Returns The HTTP content stream.
cancellationToken
The cancellation token to cancel the operation.
protected
Threading.​Tasks.​Task<​IO.​Stream>
CreateContentReadStreamAsync​()
Inherited from ByteArrayContent
Creates an HTTP content stream as an asynchronous operation for reading whose backing store is memory from the <see cref="T:System.Net.Http.ByteArrayContent" /> .
Returns The task object representing the asynchronous operation.
protected
void
SerializeToStream​(IO.​Stream stream,
TransportContext? context,
Threading.​CancellationToken cancellationToken)
Inherited from ByteArrayContent
Serializes and writes the byte array provided in the constructor to an HTTP content stream.
stream
The target stream.
context
Optional information about the transport, like the channel binding token. This parameter can be <see langword="null" /> .
cancellationToken
The cancellation token to cancel the operation.
SerializeToStreamAsync​(IO.​Stream stream,
TransportContext? context)
Inherited from ByteArrayContent
Serialize and write the byte array provided in the constructor to an HTTP content stream as an asynchronous operation.
Returns The task object representing the asynchronous operation.
stream
The target stream.
context
Information about the transport, like channel binding token. This parameter may be <see langword="null" /> .
public
void
CopyTo​(IO.​Stream stream,
TransportContext? context,
Threading.​CancellationToken cancellationToken)
Inherited from HttpContent
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)
Inherited from HttpContent
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)
Inherited from HttpContent
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)
Inherited from HttpContent
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)
Inherited from HttpContent
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
Threading.​Tasks.​Task<​IO.​Stream>
CreateContentReadStreamAsync​(Threading.​CancellationToken cancellationToken)
Inherited from HttpContent
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​()
Inherited from HttpContent
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)
Inherited from HttpContent
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​()
Inherited from HttpContent
Serialize the HTTP content to a memory buffer as an asynchronous operation.
Returns The task object representing the asynchronous operation.
LoadIntoBufferAsync​(Threading.​CancellationToken cancellationToken)
Inherited from HttpContent
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)
Inherited from HttpContent
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)
Inherited from HttpContent
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​()
Inherited from HttpContent
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)
Inherited from HttpContent
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​()
Inherited from HttpContent
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)
Inherited from HttpContent
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.
public
Threading.​Tasks.​Task<​IO.​Stream>
ReadAsStreamAsync​()
Inherited from HttpContent
Serialize the HTTP content and return a stream that represents the content as an asynchronous operation.
Returns The task object representing the asynchronous operation.
public
Threading.​Tasks.​Task<​IO.​Stream>
ReadAsStreamAsync​(Threading.​CancellationToken cancellationToken)
Inherited from HttpContent
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​()
Inherited from HttpContent
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)
Inherited from HttpContent
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.
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object