Quote:
|
the Object "o" that returns an object of type List<Item>, which is not an indexer (as in, it isn't a property that takes any arguments)
|
A property (get/set) never takes arguments, unless it is a array type and use [i] to access index ... no? How do you declare a indexer ? What it is? :/ (just to know, disgression of the actual problem ^^)
Quote:
|
What I assume you were trying to do was to access the default property of the list object (i.e. the one that allows you to put list_name[0] to retrieve the first element), which means (I'm assuming you want to keep it generic, so I'm not going to suggest casting) that you'll need to create a new PropertyInfo that gets the property "Item" of the lst object's type (assuming the type uses the default name for the default property, which List does), then use that PropertyInfo with the call to GetValue() and pass "lst" instead of "o".
|
(exactly what I want ^^)
I searched such a property with name "this" ( public T this[int index] { get; set; }) or others in the metadata definition of List<> ... And I checked again the metadata, and can't find the Item Property ... where is it defined ? I checked the herited classes too :/
Without testing, the first thing coming up to my mind is that it won't find any property with the name "Item" :/
Can you explain a litlle bit more ?
Waiting to know more on this point, I used to call the GetEnumerator() methods, and cast it to a IEnumerator ... It works for the moment, but I guess I'll be limited on the futur with this ...