这是整齐些的,跟上面语句一样:
#region overloads
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] filter)
{
PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(GetType(), filter); // notice we use the type here so we don't recurse
PropertyDescriptor[] newProps = new PropertyDescriptor[baseProps.Count]; for (int i = 0; i < baseProps.Count; i++)
{
newProps[i] = new MyFriendlyNamePropertyDescriptor(baseProps[i], filter);
string oldname = ((PropertyDescriptor)baseProps[i]).DisplayName ;
string newname = ((MyFriendlyNamePropertyDescriptor)newProps[i]).DisplayName;
} // probably wanna cache this...
return new PropertyDescriptorCollection(newProps);
} AttributeCollection ICustomTypeDescriptor.GetAttributes()
{ return TypeDescriptor.GetAttributes(this, true); } string ICustomTypeDescriptor.GetClassName()
{ return TypeDescriptor.GetClassName(this, true); } string ICustomTypeDescriptor.GetComponentName()
{ return TypeDescriptor.GetComponentName(this, true); } TypeConverter ICustomTypeDescriptor.GetConverter()
{ return TypeDescriptor.GetConverter(this, true); } EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
{ return TypeDescriptor.GetDefaultEvent(this, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents(System.Attribute[] attributes)
{ return TypeDescriptor.GetEvents(this, attributes, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
{ return TypeDescriptor.GetEvents(this, true); } PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
{ return TypeDescriptor.GetDefaultProperty(this, true); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
{ return TypeDescriptor.GetProperties(this, true); } object ICustomTypeDescriptor.GetEditor(System.Type editorBaseType)
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); } object ICustomTypeDescriptor.GetPropertyOwner(System.ComponentModel.PropertyDescriptor pd)
{ return this; } #endregion
#region overloads
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] filter)
{
PropertyDescriptorCollection baseProps = TypeDescriptor.GetProperties(GetType(), filter); // notice we use the type here so we don't recurse
PropertyDescriptor[] newProps = new PropertyDescriptor[baseProps.Count]; for (int i = 0; i < baseProps.Count; i++)
{
newProps[i] = new MyFriendlyNamePropertyDescriptor(baseProps[i], filter);
string oldname = ((PropertyDescriptor)baseProps[i]).DisplayName ;
string newname = ((MyFriendlyNamePropertyDescriptor)newProps[i]).DisplayName;
} // probably wanna cache this...
return new PropertyDescriptorCollection(newProps);
} AttributeCollection ICustomTypeDescriptor.GetAttributes()
{ return TypeDescriptor.GetAttributes(this, true); } string ICustomTypeDescriptor.GetClassName()
{ return TypeDescriptor.GetClassName(this, true); } string ICustomTypeDescriptor.GetComponentName()
{ return TypeDescriptor.GetComponentName(this, true); } TypeConverter ICustomTypeDescriptor.GetConverter()
{ return TypeDescriptor.GetConverter(this, true); } EventDescriptor ICustomTypeDescriptor.GetDefaultEvent()
{ return TypeDescriptor.GetDefaultEvent(this, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents(System.Attribute[] attributes)
{ return TypeDescriptor.GetEvents(this, attributes, true); } EventDescriptorCollection ICustomTypeDescriptor.GetEvents()
{ return TypeDescriptor.GetEvents(this, true); } PropertyDescriptor ICustomTypeDescriptor.GetDefaultProperty()
{ return TypeDescriptor.GetDefaultProperty(this, true); } PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties()
{ return TypeDescriptor.GetProperties(this, true); } object ICustomTypeDescriptor.GetEditor(System.Type editorBaseType)
{ return TypeDescriptor.GetEditor(this, editorBaseType, true); } object ICustomTypeDescriptor.GetPropertyOwner(System.ComponentModel.PropertyDescriptor pd)
{ return this; } #endregion
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货