reflection - In C#, how do you get the name of an indexed property if you only have it's index number? -


i have object created json mapper function (using litjson). contains indexed properties.

i can iterate through properties , each property value this

for(int = 0; < jdata.count;i++) {     console.writeline(jdata[i]); }  

i each property name, string, rather property value.

the closest thing i've found https://stackoverflow.com/questions/1011109/how-do-you-get-the-name-of-the-property

where works

string name = reflectionutility.getpropertyname((sample2 s) => s.foo); 

but doesn't (seemingly because it's indexed property?)

string name = reflectionutility.getpropertyname((sample2 s) => s[0]); 

i found source code. looks jsondata implements idictionary, should able access keys property.

indexers implemented functions take index argument, there's no way use reflection "name" associated given index.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

java - stack overflow exception on xml transformation -