CompoundReadStrategy Enum
Definition
Specifies how the compound-file reader sources the bytes of an opened container.
public enum CompoundReadStrategy
- Extension Methods
Fields
Buffered = 0The default: read the whole file into memory at open time, so access never touches the original source afterward.
Streaming = 1Read sectors on demand from a seekable source, bounding memory for large files. The source must remain open and unmodified for the lifetime of the returned file.
Auto = 2Choose Buffered for small sources and Streaming for large ones, comparing a seekable source's length against MaxBufferedBytes.
Remarks
// Bound memory for a large container: read sectors on demand instead of buffering it all.
using var file = CompoundFile.OpenRead("large-archive.msg", new CompoundFileOptions
{
ReadStrategy = CompoundReadStrategy.Streaming,
});
// Or let the reader pick per source: Buffered below MaxBufferedBytes, Streaming above it.
var options = new CompoundFileOptions { ReadStrategy = CompoundReadStrategy.Auto };
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |