I have a class with a Items property, which is an IList:
class Stuff {
IList<OtherStuff> Items;
}
I want to be able to receive a string within a method (I thought of this format originally: Items[0]) and be able to retrieve the first item of the Items list.
I tried this:
object MyMethod(string s, object obj) {
return obj.GetType().GetProperty(s).GetValue(obj,null);
}
with s being 'Items[0]' but it doesn't work... Also tried parsing the parameter to access only the property 'Items' of the object and then accessing the index (knowing that it is an IList).
None of these approaches worked... Any thoughts?
any thoughts?