HttpContentMultipartExtensions.ReadAsMultipartAsync<T> Method (HttpContent, T, Int32, CancellationToken)
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.
Namespace: System.Net.Http
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Syntax
'Declaration
<ExtensionAttribute> _
<DebuggerStepThroughAttribute> _
Public Shared Function ReadAsMultipartAsync(Of T As MultipartStreamProvider) ( _
content As HttpContent, _
streamProvider As T, _
bufferSize As Integer, _
cancellationToken As CancellationToken _
) As Task(Of T)
'Usage
Dim content As HttpContent
Dim streamProvider As T
Dim bufferSize As Integer
Dim cancellationToken As CancellationToken
Dim returnValue As Task(Of T)
returnValue = content.ReadAsMultipartAsync(streamProvider, _
bufferSize, cancellationToken)
[DebuggerStepThroughAttribute]
public static Task<T> ReadAsMultipartAsync<T>(
this HttpContent content,
T streamProvider,
int bufferSize,
CancellationToken cancellationToken
)
where T : MultipartStreamProvider
[ExtensionAttribute]
[DebuggerStepThroughAttribute]
public:
generic<typename T>
where T : MultipartStreamProvider
static Task<T>^ ReadAsMultipartAsync(
HttpContent^ content,
T streamProvider,
int bufferSize,
CancellationToken cancellationToken
)
[<DebuggerStepThroughAttribute>]
static member ReadAsMultipartAsync :
content:HttpContent *
streamProvider:'T *
bufferSize:int *
cancellationToken:CancellationToken -> Task<'T> when 'T : MultipartStreamProvider
JScript does not support generic types and methods.
Type Parameters
- T
The type of the MIME multipart.
Parameters
- content
Type: HttpContent
An existing HttpContent instance to use for the object's content.
- streamProvider
Type: T
A stream provider providing output streams for where to write body parts as they are parsed.
- bufferSize
Type: System.Int32
Size of the buffer used to read the contents.
- cancellationToken
Type: System.Threading.CancellationToken
The token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task<T>
A Task<TResult> representing the tasks of getting the collection of HttpContent instances where each instance represents a body part.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type HttpContent. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.118) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.118).