Thorsten Viel <(E-Mail Removed)> wrote:
> after searching and testing for hours, im off with that.
>
> Maybe you have a snippet or link for me.
>
>
> I have a class with properties. Some of the properties (not all) have a
> custom attribute. Now i want to call a method which prints out the values
> of the properties with the custom attributes, and only these values.
>
> Howto find out which Properties (Name) have those attributes (Reflection) is
> ok, but how would i access a concrete existing object and get the value of
> a property, where i have only the reflected name from.
Use PropertyInfo.GetValue. Chances are you'll already have the
PropertyInfo from the way you've found the properties with the
appropriate attribute.
--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog:
http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too