I have an object created by a json mapper function (using LitJson). It contains indexed properties.
I can iterate through the properties and get each property value like this
for(int i = 0; i < jdata.Count;i++) {
Console.WriteLine(jdata[i]);
}
I would like to get each property name, as a string, rather than the property value.
The closest thing I've found is this https://stackoverflow.com/questions/1011109/how-do-you-get-the-name-of-the-property
Where this works
string name = ReflectionUtility.GetPropertyName((Sample2 s) => s.Foo);
but this doesn't (seemingly because it's an indexed property?)
string name = ReflectionUtility.GetPropertyName((Sample2 s) => s[0]);