Tnef WriterWrite Attribute Async(Tnef Attribute Tag, String, Cancellation Token) Method
Asynchronously write an attribute with a string value.
Definition
Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
An asynchronous task context.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Task WriteAttributeAsync(
TnefAttributeTag tag,
string value,
CancellationToken cancellationToken = default
)Parameters
- tag TnefAttributeTag
- The attribute tag.
- value String
- The value.
- cancellationToken CancellationToken (Optional)
- The cancellation token.
Return Value
TaskAn asynchronous task context.
Remarks
Asynchronously writes an attribute with a string value, encoded using the Codepage and terminated by a nul character.
The value of an attribute with a String or Text type and the value of the MessageClass and OriginalMessageClass attributes may be written as a string. A message class must consist of between 1 and 254 printable ASCII characters.
Exceptions
| ArgumentNullException | value is . |
| ArgumentException |
tag is not an attribute that can be written. -or- The value of tag is not a string. -or- value is not a valid message class. |
| 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. |