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.​MultipartFormDataContent
Assembly: System.Net.Http
Inheritance: object → HttpContent → MultipartContent → MultipartFormDataContent
Implemented Interfaces
- IDisposable Implemented by: HttpContent
- Collections.​Generic.​IEnumerable`1 (Inherits: IEnumerable) Implemented by: MultipartContent
Provides a container for content encoded using multipart/form-data MIME type.
Properties
public
HeaderEncodingSelector<​HttpContent>
HeaderEncodingSelector
Gets or sets a callback that decode response header values.
public
HttpContentHeaders
Headers
Gets the HTTP content headers as defined in RFC 2616.
Methods
public
void
Add​(HttpContent content)
Add HTTP content to a collection of <see cref="T:System.Net.Http.HttpContent" /> objects that get serialized to multipart/form-data MIME type.
content
The HTTP content to add to the collection.
public
void
Add​(HttpContent content,
string name)
Add HTTP content to a collection of <see cref="T:System.Net.Http.HttpContent" /> objects that get serialized to multipart/form-data MIME type.
content
The HTTP content to add to the collection.
name
The name for the HTTP content to add.
public
void
Add​(HttpContent content,
string name,
string fileName)
Add HTTP content to a collection of <see cref="T:System.Net.Http.HttpContent" /> objects that get serialized to multipart/form-data MIME type.
content
The HTTP content to add to the collection.
name
The name for the HTTP content to add.
fileName
The file name for the HTTP content to add to the collection.
SerializeToStreamAsync​(IO.​Stream stream,
TransportContext? context,
Threading.​CancellationToken cancellationToken)
Serialize and write the content 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 MultipartContent
Serializes the HTTP content to a stream using the multipart/* encoding.
Returns The HTTP content stream that represents the multipart/* encoded HTTP content.
cancellationToken
The cancellation token to cancel the operation.
protected
Threading.​Tasks.​Task<​IO.​Stream>
CreateContentReadStreamAsync​()
Inherited from MultipartContent
Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.
Returns The task object representing the asynchronous operation.
protected
Threading.​Tasks.​Task<​IO.​Stream>
CreateContentReadStreamAsync​(Threading.​CancellationToken cancellationToken)
Inherited from MultipartContent
Serializes the HTTP content to a stream using the multipart/* encoding as an asynchronous operation.
Returns The task object representing the asynchronous operation.
cancellationToken
The cancellation token to cancel the operation.
protected
void
Dispose​(bool disposing)
Inherited from MultipartContent
Releases the unmanaged resources used by the <see cref="T:System.Net.Http.MultipartContent" /> 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.
public
Collections.​Generic.​IEnumerator<​HttpContent>
GetEnumerator​()
Inherited from MultipartContent
Returns an enumerator that iterates through the collection of <see cref="T:System.Net.Http.HttpContent" /> objects that get serialized using the multipart/* content type specification.
Returns An object that can be used to iterate through the collection.
protected
void
SerializeToStream​(IO.​Stream stream,
TransportContext? context,
Threading.​CancellationToken cancellationToken)
Inherited from MultipartContent
Serializes the multipart HTTP content to a 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.
SerializeToStreamAsync​(IO.​Stream stream,
TransportContext? context)
Inherited from MultipartContent
Serialize the multipart 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" /> .
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.
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" /> .
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