PropertyInfo.GetValue(object Obj, object[] index)

S

samueltilden

I am writing a very generic DumpObject(object Obj) method.

I can easily GetType() and GetType().GetProperties().

I can easily PropertyInfo.GetValue(Obj, null) for scalar variables.

The problem is arrays or collections which require this syntax:

PropertyInfo.GetValue(Object, Object[] index)

What do I enter for the array of objects, called "index" in the
documentation?

No matter what I have tried so far, I always get an "argument out of
range exception" when I try to execute:

PropertyInfo.GetValue(Object, Object[] index)

Any ideas? clues?

Thanks.
 
M

Marc Gravell

Any ideas? clues?

Answered with an example on the previous post. In this case, it isn't
the *property* that is indexed, but the value returned *from* the
property.

Marc
 

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