CoreActivity.FromJsonStreamAsync 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
| Name | Description |
|---|---|
| FromJsonStreamAsync(Stream, CancellationToken) |
Asynchronously deserializes a JSON stream into a CoreActivity object. |
| FromJsonStreamAsync<T>(Stream, CancellationToken) |
Asynchronously deserializes a JSON value from the specified stream into an instance of type T. |
| FromJsonStreamAsync<T>(Stream, JsonTypeInfo<T>, CancellationToken) |
Asynchronously deserializes a JSON stream into an instance of type |
FromJsonStreamAsync(Stream, CancellationToken)
Asynchronously deserializes a JSON stream into a CoreActivity object.
public static System.Threading.Tasks.ValueTask<Microsoft.Teams.Core.Schema.CoreActivity?> FromJsonStreamAsync(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default);
static member FromJsonStreamAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Teams.Core.Schema.CoreActivity>
Public Shared Function FromJsonStreamAsync (stream As Stream, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of CoreActivity)
Parameters
- stream
- Stream
The stream containing JSON data to deserialize.
- cancellationToken
- CancellationToken
A cancellation token to cancel the operation.
Returns
A task that represents the asynchronous operation. The task result contains the deserialized CoreActivity instance, or null if deserialization fails.
Applies to
FromJsonStreamAsync<T>(Stream, CancellationToken)
Asynchronously deserializes a JSON value from the specified stream into an instance of type T.
public static System.Threading.Tasks.ValueTask<T?> FromJsonStreamAsync<T>(System.IO.Stream stream, System.Threading.CancellationToken cancellationToken = default) where T : Microsoft.Teams.Core.Schema.CoreActivity;
static member FromJsonStreamAsync : System.IO.Stream * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T (requires 'T :> Microsoft.Teams.Core.Schema.CoreActivity)> (requires 'T :> Microsoft.Teams.Core.Schema.CoreActivity)
Public Shared Function FromJsonStreamAsync(Of T As CoreActivity) (stream As Stream, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)
Type Parameters
- T
The type of the object to deserialize. Must derive from CoreActivity.
Parameters
- stream
- Stream
The stream containing the JSON data to deserialize. The stream must be readable and positioned at the start of the JSON content.
- cancellationToken
- CancellationToken
A cancellation token that can be used to cancel the asynchronous operation.
Returns
A ValueTask that represents the asynchronous operation. The result contains an instance of type T if deserialization is successful; otherwise, null.
Remarks
The caller is responsible for managing the lifetime of the provided stream. The method uses default JSON serialization options.
Applies to
FromJsonStreamAsync<T>(Stream, JsonTypeInfo<T>, CancellationToken)
Asynchronously deserializes a JSON stream into an instance of type T using the specified JsonTypeInfo<T> for source-generated serialization.
public static System.Threading.Tasks.ValueTask<T?> FromJsonStreamAsync<T>(System.IO.Stream stream, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default) where T : Microsoft.Teams.Core.Schema.CoreActivity;
static member FromJsonStreamAsync : System.IO.Stream * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'T (requires 'T :> Microsoft.Teams.Core.Schema.CoreActivity)> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<'T (requires 'T :> Microsoft.Teams.Core.Schema.CoreActivity)> (requires 'T :> Microsoft.Teams.Core.Schema.CoreActivity)
Public Shared Function FromJsonStreamAsync(Of T As CoreActivity) (stream As Stream, jsonTypeInfo As JsonTypeInfo(Of T), Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of T)
Type Parameters
- T
The type of the activity to deserialize. Must inherit from CoreActivity.
Parameters
- stream
- Stream
The stream containing JSON data to deserialize.
- jsonTypeInfo
- JsonTypeInfo<T>
The JSON type info that provides deserialization metadata for type T.
- cancellationToken
- CancellationToken
A cancellation token to cancel the operation.
Returns
A ValueTask<TResult> representing the asynchronous operation. The result contains the deserialized activity, or null if deserialization fails.