I have created a type and with few properties and assigned values to those properties. I need to bind this class with a property grid. I need to add/decorate custom attribute to some of the properties i have created using reflection.
Could some one help me addi开发者_JAVA百科ng a custom attribute using reflection.
[TypeConverter(typeof(DropDownConverter))]
public string NAME
{
get { return m_name; }
set
{
m_name = value;
}
}
Finally the property should have a TypeConverter attribute added to it.
Thanks, Kishore Borra.
You need to implement ICustomTypeDescriptor
and implement GetProperties
to return custom PropertyDescriptor
s that contain you attributes.
精彩评论