Ciaran O''Donnell <Ci************@discussions.microsoft.comwrote:
"Marc Gravell" wrote:
object value = obj.GetType().GetProperty("PropertyName").GetValue (obj,
null);
The null passed at the end are binding flags which could enable you to read
private/internal properties too.
Not quite. The null in the call to GetValue above is the "index" value
in case you're dealing with what in C# terms is an indexer instead of a
property (they're both properties in .NET terminology). The overload
which takes a BindingFlags is a different one (and far less commonly
used, IME) - you'd normally specify the BindingFlags in the call to
GetProperty to get at a private/internal property.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too