I tried to get a row from a table by indexing it, this resulted in a null:
var settingsTable= tml["Einstellungen"].AsTable;
var tableRow= settingsTable[0];
There should be a possibility to use an indexer to get the key and its value, like an Dictionary returns it.
With strings this works fine, but integers results into null, but I expected to get something 😉
I added this code to the TomlTable to fix this:
public new KeyValuePair<string, TomlNode> this[int index] { get { if (index > RawTable.Count) return new KeyValuePair<string, TomlNode>(); return RawTable.ElementAt(index); } set { if (index > RawTable.Count) return; RawTable[RawTable.ElementAt(index).Key] = value!.Value; } }
Thank you for this nice peace of software!
I tried to get a row from a table by indexing it, this resulted in a null:
var settingsTable= tml["Einstellungen"].AsTable; var tableRow= settingsTable[0];
There should be a possibility to use an indexer to get the key and its value, like an Dictionary returns it. With strings this works fine, but integers results into null, but I expected to get something 😉
I added this code to the TomlTable to fix this:
public new KeyValuePair<string, TomlNode> this[int index] { get { if (index > RawTable.Count) return new KeyValuePair<string, TomlNode>(); return RawTable.ElementAt(index); } set { if (index > RawTable.Count) return; RawTable[RawTable.ElementAt(index).Key] = value!.Value; } }