MediaTypeFormatter.WriteToStreamAsync Method
Namespace: System.Net.Http.Formatting
Assembly: System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)
Overload List
Name | Description | |
---|---|---|
![]() |
WriteToStreamAsync(Type, Object, Stream, HttpContent, TransportContext) | Asynchronously writes an object of the specified type. |
![]() |
WriteToStreamAsync(Type, Object, Stream, HttpContent, TransportContext, CancellationToken) | Asynchronously writes an object of the specified type. |
See Also
MediaTypeFormatter Class
System.Net.Http.Formatting Namespace
Return to top
MediaTypeFormatter.WriteToStreamAsync Method (Type, Object, Stream, HttpContent, TransportContext)
Asynchronously writes an object of the specified type.
Syntax
public virtual Task WriteToStreamAsync(
Type type,
object value,
Stream writeStream,
HttpContent content,
TransportContext transportContext
)
public:
virtual Task^ WriteToStreamAsync(
Type^ type,
Object^ value,
Stream^ writeStream,
HttpContent^ content,
TransportContext^ transportContext
)
abstract WriteToStreamAsync :
type:Type *
value:Object *
writeStream:Stream *
content:HttpContent *
transportContext:TransportContext -> Task
override WriteToStreamAsync :
type:Type *
value:Object *
writeStream:Stream *
content:HttpContent *
transportContext:TransportContext -> Task
Public Overridable Function WriteToStreamAsync (
type As Type,
value As Object,
writeStream As Stream,
content As HttpContent,
transportContext As TransportContext
) As Task
Parameters
type
Type: System.TypeThe type of the object to write.
value
Type: System.ObjectThe object value to write. It may be null.
writeStream
Type: System.IO.StreamThe Stream to which to write.
content
Type: System.Net.Http.HttpContentThe HttpContent if available. It may be null.
transportContext
Type: System.Net.TransportContextThe TransportContext if available. It may be null.
Return Value
Type: System.Threading.Tasks.Task
A Task that will perform the write.
Exceptions
Exception | Condition |
---|---|
NotSupportedException | Derived types need to support writing. |
Return to top
MediaTypeFormatter.WriteToStreamAsync Method (Type, Object, Stream, HttpContent, TransportContext, CancellationToken)
Asynchronously writes an object of the specified type.
Syntax
public virtual Task WriteToStreamAsync(
Type type,
object value,
Stream writeStream,
HttpContent content,
TransportContext transportContext,
CancellationToken cancellationToken
)
public:
virtual Task^ WriteToStreamAsync(
Type^ type,
Object^ value,
Stream^ writeStream,
HttpContent^ content,
TransportContext^ transportContext,
CancellationToken cancellationToken
)
abstract WriteToStreamAsync :
type:Type *
value:Object *
writeStream:Stream *
content:HttpContent *
transportContext:TransportContext *
cancellationToken:CancellationToken -> Task
override WriteToStreamAsync :
type:Type *
value:Object *
writeStream:Stream *
content:HttpContent *
transportContext:TransportContext *
cancellationToken:CancellationToken -> Task
Public Overridable Function WriteToStreamAsync (
type As Type,
value As Object,
writeStream As Stream,
content As HttpContent,
transportContext As TransportContext,
cancellationToken As CancellationToken
) As Task
Parameters
type
Type: System.TypeThe type of the object to write.
value
Type: System.ObjectThe object value to write. It may be null.
writeStream
Type: System.IO.StreamThe Stream to which to write.
content
Type: System.Net.Http.HttpContentThe HttpContent if available. It may be null.
transportContext
Type: System.Net.TransportContextThe TransportContext if available. It may be null.
cancellationToken
Type: System.Threading.CancellationTokenThe token to cancel the operation.
Return Value
Type: System.Threading.Tasks.Task
A Task that will perform the write.
Exceptions
Exception | Condition |
---|---|
NotSupportedException | Derived types need to support writing. |
Return to top