TomlDocumentOptions Struct
Definition
Defines the customizations applied when parsing a TomlDocument.
public struct TomlDocumentOptions
- Inherited Members
- Extension Methods
Remarks
SpecVersion selects the grammar the parser enforces. The default, V1_0 , is the most widely deployed released specification; V1_1 additionally accepts the TOML v1.1.0 grammar features.
MaxDepth bounds the nesting of tables and arrays the parser will materialize, guarding against
stack-exhausting input. A value of 0 selects the default of 64, and a larger value is clamped to the hard
ceiling Bodu.Text.Toml.TomlLimits.AbsoluteMaxDepth; a document that nests deeper than the effective limit throws
TomlFormatException rather than risking a StackOverflowException.
using TomlDocument document = TomlDocument.Parse("value = 1"u8, new TomlDocumentOptions
{
SpecVersion = TomlSpecVersion.V1_0, // reject TOML 1.1-only syntax
MaxDepth = 32,
});
Properties
MaxDepth
Gets or sets the maximum nesting depth of tables and arrays the parser will accept.
public int MaxDepth { readonly get; set; }
Property Value
- int
The maximum nesting depth;
0selects the default of 64, clamped to Bodu.Text.Toml.TomlLimits.AbsoluteMaxDepth.
SpecVersion
Gets or sets the version of the TOML specification the parser enforces.
public TomlSpecVersion SpecVersion { readonly get; set; }
Property Value
- TomlSpecVersion
The specification version applied during parsing.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |