indexers and reflection

I

Iain

I'm writing some reflection code which resolves the value of a complex
expression (e.g. MyInfo.Customers[3].Orders["Order305"].Date), against a
specific object.

I'm struggling a bit with indexers.

I'm not entirely sure how I can find the indexer(s?) on an object. although
there is a default name 'Item' it doesn't have to be that, and there seems
to be no 'GetIndexers' method on Type (I know that an indexer is a property,
but which one?).

Anyone help?

Iain
 
M

Mattias Sjögren

Iain,
I'm struggling a bit with indexers.

I'm not entirely sure how I can find the indexer(s?) on an object. although
there is a default name 'Item' it doesn't have to be that, and there seems
to be no 'GetIndexers' method on Type (I know that an indexer is a property,
but which one?).

Anyone help?


Look for the System.Reflection.DefaultMemberAttribute on the type.



Mattias
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top