TnefWriterWriteAttributeAsync(TnefAttributeTag, Int32, CancellationToken) Method

Asynchronously write an attribute with an integer value.

Definition

Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Task WriteAttributeAsync(
	TnefAttributeTag tag,
	int value,
	CancellationToken cancellationToken = default
)

Parameters

tag  TnefAttributeTag
The attribute tag.
value  Int32
The value.
cancellationToken  CancellationToken  (Optional)
The cancellation token.

Return Value

Task
An asynchronous task context.

Remarks

Asynchronously writes an attribute with an integer value.

The value of an attribute with a Short or Word type is written as a 16-bit integer and the value of an attribute with a Long or DWord type is written as a 32-bit integer.

Exceptions

ArgumentException

tag is not an attribute that can be written.

-or-

The value of tag is not an integer.

ArgumentOutOfRangeException value does not fit in a 16-bit attribute value.
ObjectDisposedException The writer has been disposed.
InvalidOperationException

The attribute cannot be written at this point in the stream.

-or-

The stream or property writer for the previous attribute has not been disposed.

OperationCanceledException The operation was canceled via the cancellation token.
IOException An I/O error occurred.

See Also