FormatWith
FormatWith copied to clipboard
Add support for indexers (support for Arrays/Lists/Dictionaries/etc)
At present, FormatWith supports basic property navigations in parameter keys. However, it does not support combining this with indexers to navigate into objects arrays, lists, or dictionaries.
For example, this is currently supported:
string result = "{foo.bar}".FormatWith(new
{
foo = new { bar = "test" }
});
However, we should be able to do this:
string result = "{foo[\"bar\"].Length}".FormatWith(new
{
foo = new Dictionary<string, string> { ["bar"] = "test" }
});
This is the code that will need to be changed:
https://github.com/crozone/FormatWith/blob/3fbb5ee16b5db299ead5d8851becba8b08021b86/FormatWith/Internal/FormatWithMethods.cs#L320-L361
This will potentially solve https://github.com/crozone/FormatWith/issues/23.