Class XmlSingleStreamLoaderOptions
Options for configuring an XmlSingleStreamLoader<TRecord>.
public sealed class XmlSingleStreamLoaderOptions
- Inheritance
-
XmlSingleStreamLoaderOptions
- Inherited Members
Examples
var loader = new XmlSingleStreamLoader<Person>
(
stream,
new XmlSingleStreamLoaderOptions
{
RootElementName = "People",
LeaveOpen = false,
}
);
Properties
LeaveOpen
Gets or initializes a value indicating whether the stream should remain open after loading completes.
public bool LeaveOpen { get; init; }
Property Value
Remarks
When true (default) the caller retains responsibility for the stream
lifetime. When false the stream is closed when loading finishes,
mirroring the behaviour of StreamWriter and
BinaryWriter.
RootElementName
Gets or initializes the name of the XML root element that wraps all serialized items.
public string? RootElementName { get; init; }
Property Value
Remarks
When null (default) the root element name is derived automatically as
ArrayOf{TypeName} (e.g. ArrayOfPerson). An empty or whitespace
value is not valid and will cause XmlSingleStreamLoader<TRecord>
to throw ArgumentException during construction.