GetProperties() public method

public GetProperties ( ITypeDescriptorContext context, object value ) : PropertyDescriptorCollection
context ITypeDescriptorContext
value object
return PropertyDescriptorCollection
Beispiel #1
0
         public static PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, Attribute[] attributes, object component, TypeConverter converter)
        {
            if (component == null) return null;

            if (component is ICustomTypeDescriptor)
            {
                ICustomTypeDescriptor descriptor = (ICustomTypeDescriptor)component;
                if (attributes != null)
                    return descriptor.GetProperties(attributes);
                return descriptor.GetProperties();
            }

            // Note that this assumes that converter supports GetProperties!
            if (converter != null)
            {
                return converter.GetProperties(context, component, attributes);
            }

            Type type = component.GetType();
            
            if (attributes != null)
                return TypeDescriptor.GetProperties(component, attributes);

            return TypeDescriptor.GetProperties(component);
        }
 /// <summary>
 /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
 /// </summary>
 /// <param name="context">An <see cref="T:System.ComponentModel.ITypeDescriptorContext"></see> that provides a format context.</param>
 /// <param name="value">An <see cref="T:System.Object"></see> that specifies the type of array for which to get properties.</param>
 /// <param name="attributes">An array of type <see cref="T:System.Attribute"></see> that is used as a filter.</param>
 /// <returns>
 /// A <see cref="T:System.ComponentModel.PropertyDescriptorCollection"></see> with the properties that are exposed for this data type, or null if there are no properties.
 /// </returns>
 public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes)
 {
     return(baseTypeConverter.GetProperties(context, value, attributes));
 }