Get DefautlValue of a Property?

  • Thread starter Thread starter Özden Irmak
  • Start date Start date
Ö

Özden Irmak

Hi,

I want to get the DefaultValue of a Property from an instance of a class I
have? Can anybody help me?

Regards,

Özden
 
Hi Ozden,

I'm assuming you mean the DefaultValueAttribute.

You can retrieve attributes using the Type of a class.
E.g. if you have an object o, you can use:
o.GetType().GetCustomAttributes(typeof(DefaultValueAttribute), false)

Apart from this, a Type has an Attributes property.

Hope this helps,
Michel
 
Yes, I meant the value you set using DefaultValueAttribute...

This seems the solution, I should have looked carefully to this Attribute
class before posting it here...:)

Thank you very much...

Özden
 
Back
Top