TomlTable Class

A mutable TOML table: the root table of a document, a table defined by a header, or an inline table. The keys keep the order they are added in.

Inheritance
TomlNode TomlTable
Implements

Nested types

NameDescription
TomlTable.EnumeratorEnumerates the keys and values of a table.

Constructors

NameDescription
TomlTable()Initializes a new empty table.
TomlTable(bool)Initializes a new empty table.
TomlTable(IEnumerable<KeyValuePair<string, TomlNode>>)Initializes a new table with keys and values.

TomlTable overloads

TomlTable()

TomlTable.cs

Initializes a new empty table.

public TomlTable()

TomlTable(bool)

TomlTable.cs

Initializes a new empty table.

public TomlTable(bool inline)
Parameters
inline bool
true to write the table as an inline table, such as { a = 1 }.

TomlTable(IEnumerable<KeyValuePair<string, TomlNode>>)

TomlTable.cs

Initializes a new table with keys and values.

public TomlTable(IEnumerable<KeyValuePair<string, TomlNode>> properties)
Parameters
properties IEnumerable<KeyValuePair<string, TomlNode>>
The keys and values.

Properties

NameDescription
CountGets the number of keys.
IsInlineGets or sets a value indicating whether the table is written as an inline table, such as { a = 1 }.
KeysGets the keys, in order.
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.IsReadOnly
System.Collections.Generic.IReadOnlyDictionary<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>.Keys
System.Collections.Generic.IReadOnlyDictionary<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>.Values
ValuesGets the values, in the order of their keys.

Gets the number of keys.

public int Count { get; }

Property value

int

IsInline

TomlTable.cs

Gets or sets a value indicating whether the table is written as an inline table, such as { a = 1 }.

public bool IsInline { get; set; }

Property value

bool

Gets the keys, in order.

public ICollection<string> Keys { get; }

Property value

ICollection<string>

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.IsReadOnly

TomlTable.cs

Property value

bool

No documentation is available.

System.Collections.Generic.IReadOnlyDictionary<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>.Keys

TomlTable.cs

Property value

IEnumerable<string>

No documentation is available.

System.Collections.Generic.IReadOnlyDictionary<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>.Values

TomlTable.cs

Property value

IEnumerable<TomlNode>

No documentation is available.

Gets the values, in the order of their keys.

public ICollection<TomlNode> Values { get; }

Property value

ICollection<TomlNode>

Indexers

NameDescription
this[string]Gets or sets the value of a key. The getter returns null when the table has no such key.
this[string]
this[string]

this[string]

TomlTable.cs

Gets or sets the value of a key. The getter returns null when the table has no such key.

public new TomlNode? this[string key] { get; set; }

Parameters

key string

Property value

TomlNode?

Exceptions

ArgumentNullException
The key or the value is null.

this[string]

TomlTable.cs
TomlNode IDictionary<string, TomlNode>.this[string key] { get; set; }

Parameters

key string

Property value

TomlNode

No documentation is available.

this[string]

TomlTable.cs

Parameters

key string

Property value

TomlNode

No documentation is available.

Methods

NameDescription
Add(string, TomlNode)Adds a key and its value.
Clear()Removes all the keys.
ContainsKey(string)Gets a value indicating whether the table has a key.
DeepClone()Gets a copy of the node and its descendants, without a parent.
GetEnumerator()Gets an enumerator of the keys and values, in order.
GetValueKind()Gets the kind of the value.
Parse(Stream, TomlDocumentOptions)Parses a UTF-8 TOML document read from a stream.
Parse(ReadOnlyMemory<byte>, TomlDocumentOptions)Parses a UTF-8 TOML document.
Parse(string, TomlDocumentOptions)Parses a TOML document.
Remove(string)Removes a key.
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Add(KeyValuePair<string, TomlNode>)
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Contains(KeyValuePair<string, TomlNode>)
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.CopyTo(KeyValuePair<string, TomlNode>[], int)
System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Remove(KeyValuePair<string, TomlNode>)
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.GetEnumerator()
System.Collections.IEnumerable.GetEnumerator()
TryGetValue(string, TomlNode)Gets the value of a key.
WriteTo(Utf8TomlWriter)Writes the node with a writer: a table as key/value pairs and sub-tables where the writer expects a key, and as an inline table otherwise.

Add(string, TomlNode)

TomlTable.cs

Adds a key and its value.

public void Add(string key, TomlNode value)

Parameters

key string
value TomlNode

Exceptions

ArgumentException
The table already has the key.

Removes all the keys.

public void Clear()

ContainsKey(string)

TomlTable.cs

Gets a value indicating whether the table has a key.

public bool ContainsKey(string key)

Parameters

key string

Returns

bool

DeepClone()

TomlTable.cs

Gets a copy of the node and its descendants, without a parent.

public override TomlNode DeepClone()

Returns

TomlNode

GetEnumerator()

TomlTable.cs

Gets an enumerator of the keys and values, in order.

public TomlTable.Enumerator GetEnumerator()

GetValueKind()

TomlTable.cs

Gets the kind of the value.

public override TomlValueKind GetValueKind()

Parse overloads

Parse(Stream, TomlDocumentOptions)

TomlTable.cs

Parses a UTF-8 TOML document read from a stream.

public static TomlTable Parse(Stream utf8Toml, TomlDocumentOptions options = default)
Parameters
utf8Toml Stream
options TomlDocumentOptions
Returns

TomlTable

Exceptions
TomlException
The document is not valid TOML.

Parse(ReadOnlyMemory<byte>, TomlDocumentOptions)

TomlTable.cs

Parses a UTF-8 TOML document.

public static TomlTable Parse(ReadOnlyMemory<byte> utf8Toml, TomlDocumentOptions options = default)
Parameters
utf8Toml ReadOnlyMemory<byte>
options TomlDocumentOptions
Returns

TomlTable

Exceptions
TomlException
The document is not valid TOML.

Parse(string, TomlDocumentOptions)

TomlTable.cs

Parses a TOML document.

public static TomlTable Parse(string toml, TomlDocumentOptions options = default)
Parameters
toml string
options TomlDocumentOptions
Returns

TomlTable

Exceptions
TomlException
The document is not valid TOML.

Remove(string)

TomlTable.cs

Removes a key.

public bool Remove(string key)

Parameters

key string

Returns

bool true when the key was removed.

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Add(KeyValuePair<string, TomlNode>)

TomlTable.cs

No documentation is available.

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Contains(KeyValuePair<string, TomlNode>)

TomlTable.cs

No documentation is available.

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.CopyTo(KeyValuePair<string, TomlNode>[], int)

TomlTable.cs

Parameters

array KeyValuePair<string, TomlNode>[]
arrayIndex int

No documentation is available.

System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.Remove(KeyValuePair<string, TomlNode>)

TomlTable.cs

No documentation is available.

System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,Meziantou.Framework.Toml.Nodes.TomlNode>>.GetEnumerator()

TomlTable.cs

System.Collections.IEnumerable.GetEnumerator()

TomlTable.cs
IEnumerator IEnumerable.GetEnumerator()

No documentation is available.

TryGetValue(string, TomlNode)

TomlTable.cs

Gets the value of a key.

public bool TryGetValue(string key, out TomlNode value)

Parameters

key string
value TomlNode

Returns

bool

WriteTo(Utf8TomlWriter)

TomlTable.cs

Writes the node with a writer: a table as key/value pairs and sub-tables where the writer expects a key, and as an inline table otherwise.

public override void WriteTo(Utf8TomlWriter writer)

Parameters

writer Utf8TomlWriter
The writer.