Class AttachmentContent
The content of an : a source that opens a new stream from the start on every read. Reading
more than once is required, not optional: Multicast branches, redelivery and a resend over a fresh connection all
read the same attachment again, so a forward-only stream is not accepted as a source.
public abstract class AttachmentContent
Inheritance
Properties
Methods
DeepCopy()
An isolated copy for a checkpoint snapshot: the content is read into memory, so the copy outlives the source and
public virtual AttachmentContent DeepCopy()
FromBytes(byte[])
Content held in memory. The array is shared, not copied, like a byte[] body.
public static AttachmentContent FromBytes(byte[] bytes)
FromFile(string, bool)
Content of a file, read from disk on every open.
public static AttachmentContent FromFile(string path, bool deleteWithExchange = false)
FromStreamCache(StreamCache)
Content of a completed ; every open gets an independent reader. The cache is disposed
public static AttachmentContent FromStreamCache(StreamCache cache)
OpenRead()
Opens a new read-only stream positioned at the start of the content.
public abstract Stream OpenRead()
OpenReadAsync(CancellationToken)
Opens a new read-only stream positioned at the start of the content.
public virtual ValueTask<Stream> OpenReadAsync(CancellationToken ct = default)
ReadAllBytesAsync(CancellationToken)
Reads the whole content into a new array.
public virtual ValueTask<byte[]> ReadAllBytesAsync(CancellationToken ct = default)
Remarks
A source that holds a resource (a , a file to delete) implements
; the exchange that carries the message releases it like a disposable body.