TPath

TPath is a special language designed to make it even easier to work with TOML. Take a look:

# data.toml

[person]
name.first = "Denis"
name.last = "Tsvikevich"
TomlTable table = Tomen.Tomen.ReadFile("data.toml");

Console.WriteLine(table.Path("person.name.first").AsString()); // "Denis"

As you can see, Path is an extension method of TomenValue and TPath is a string parameter in this method. Instead of Path method you can use it's generic version Path<T>: parameter T is a type that returns when TPath evaluated:

TomlTable table = Tomen.Tomen.ReadFile("data.toml");

Console.WriteLine(table.Path<string>("person.name.first")); // path returns System.String!

Instead of key name you can use indices:

TomlTable table = Tomen.Tomen.ReadFile("data.toml");

Console.WriteLine(table.Path<string>("person.name[0]")); // same as person.name.first

If you want to select all values of the table, you can use * operator. This operator returns TomlArray when used with table.

TomlTable table = Tomen.Tomen.ReadFile("data.toml");

// note: returned array is casted to string[]
string[] name = table.Path<string[]>("person.name.*");
Console.WriteLine(name[0]) // Denis
Console.WriteLine(name[1]) // Tsvikevich