C
Christopher Wells
I want to implement a class derived from ICustomTypeDescriptor.
My current implementation of the overloaded GetProperties methods look like
this:
public PropertyDescriptorCollection GetProperties(Attribute[]
attributes)
{
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(m_thing_with_properties,attributes,true);
return hack_property_display_names(properties);
}
PropertyDescriptorCollection
System.ComponentModel.ICustomTypeDescriptor.GetProperties()
{
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(m_thing_with_properties,true);
return hack_property_display_names(properties);
}
where "hack_property_display_names" is a private method that alters the
PropertyDescriptorCollection.
My problem with this implementation is that I'm not cacheing/controlling the
PropertyDescriptorCollection. I would like to:
* Construct my PropertyDescriptorCollection in my constructor and save it
as private member data
* Change the GetProperties() methods to return thhis private data.
My problem with doing this is that I don't understand the "Attribute[]
attributes" parameter. The help says only that it acts as a filter. If I
have a PropertyDescriptorCollection, what does it mean to (or, how do I)
apply a "Attribute[] attributes" filter to it?
My current implementation of the overloaded GetProperties methods look like
this:
public PropertyDescriptorCollection GetProperties(Attribute[]
attributes)
{
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(m_thing_with_properties,attributes,true);
return hack_property_display_names(properties);
}
PropertyDescriptorCollection
System.ComponentModel.ICustomTypeDescriptor.GetProperties()
{
PropertyDescriptorCollection properties =
TypeDescriptor.GetProperties(m_thing_with_properties,true);
return hack_property_display_names(properties);
}
where "hack_property_display_names" is a private method that alters the
PropertyDescriptorCollection.
My problem with this implementation is that I'm not cacheing/controlling the
PropertyDescriptorCollection. I would like to:
* Construct my PropertyDescriptorCollection in my constructor and save it
as private member data
* Change the GetProperties() methods to return thhis private data.
My problem with doing this is that I don't understand the "Attribute[]
attributes" parameter. The help says only that it acts as a filter. If I
have a PropertyDescriptorCollection, what does it mean to (or, how do I)
apply a "Attribute[] attributes" filter to it?