Tnef WriterTemporary Stream Factory Property
Get or set the factory used to create temporary streams for buffering attributes.
Definition
Namespace: MimeKit.Tnef
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
The temporary stream factory.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public Func<Stream> TemporaryStreamFactory { get; set; }Property Value
FuncStreamThe temporary stream factory.
Remarks
The factory is called by OpenAttributeStream(TnefAttributeTag) and OpenPropertyWriter(TnefAttributeTag). Each call must return a new, empty, readable, writable and seekable stream positioned at zero. The default factory creates a MemoryBlockStream.
The writer owns the returned streams and disposes them after their attributes have been written or discarded, regardless of the constructor's leaveOpen argument. Disposing an attribute stream or property writer does not immediately dispose its backing stream.
Embedded message writers inherit this factory when they are created. Changing the factory does not affect streams or embedded message writers that have already been created.
Example
C#
writer.TemporaryStreamFactory = () => new FileStream (
Path.Combine (temporaryDirectory, Path.GetRandomFileName ()),
FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None, 4096,
FileOptions.DeleteOnClose | FileOptions.Asynchronous);
Exceptions
| ArgumentNullException | value is . |