BinaryData.FromStreamAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
FromStreamAsync(Stream, CancellationToken) |
Creates a BinaryData instance from the specified stream. The stream is not disposed by this method. |
FromStreamAsync(Stream, String, CancellationToken) |
FromStreamAsync(Stream, CancellationToken)
- Source:
- BinaryData.cs
- Source:
- BinaryData.cs
- Source:
- BinaryData.cs
Creates a BinaryData instance from the specified stream. The stream is not disposed by this method.
public static System.Threading.Tasks.Task<BinaryData> FromStreamAsync (System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default);
static member FromStreamAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.Task<BinaryData>
Public Shared Function FromStreamAsync (stream As Stream, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BinaryData)
Parameters
- stream
- Stream
The stream containing the data.
- cancellationToken
- CancellationToken
A token that may be used to cancel the operation.
Returns
A value representing all of the data remaining in stream
.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by FromStream(Stream).
Applies to
FromStreamAsync(Stream, String, CancellationToken)
- Source:
- BinaryData.cs
- Source:
- BinaryData.cs
- Source:
- BinaryData.cs
public static System.Threading.Tasks.Task<BinaryData> FromStreamAsync (System.IO.Stream stream, string? mediaType, System.Threading.CancellationToken cancellationToken = default);
static member FromStreamAsync : System.IO.Stream * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<BinaryData>
Public Shared Function FromStreamAsync (stream As Stream, mediaType As String, Optional cancellationToken As CancellationToken = Nothing) As Task(Of BinaryData)
Parameters
- stream
- Stream
- mediaType
- String
- cancellationToken
- CancellationToken
Returns
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.