Share via


PropertyGridObject.ICustomTypeDescriptor.GetProperties Method

Definition

Returns the properties for the property grid.

Overloads

ICustomTypeDescriptor.GetProperties()

Returns the properties for the property grid.

ICustomTypeDescriptor.GetProperties(Attribute[])

Returns the properties for the property grid, using the specified attribute array as a filter.

ICustomTypeDescriptor.GetProperties()

Returns the properties for the property grid.

 virtual System::ComponentModel::PropertyDescriptorCollection ^ System.ComponentModel.ICustomTypeDescriptor.GetProperties() = System::ComponentModel::ICustomTypeDescriptor::GetProperties;
System.ComponentModel.PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties ();
Function GetProperties () As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties

Returns

A PropertyDescriptorCollection object that represents the properties for the property grid.

Implements

Examples

The following example duplicates the <xref:Microsoft.Web.Management.Client.PropertyGridObject.System.ComponentModel.ICustomTypeDescriptor.GetProperties> overload.

private PropertyDescriptorCollection MyGetPropertiesImpl(
    Attribute[] attributes) {
    PropertyDescriptorCollection props = 
        GetProperties(attributes);

    if (ReadOnly) {
        Type thisType = GetType();
        ArrayList readOnlyProperties = new ArrayList();
        foreach (PropertyDescriptor prop in props) {
            readOnlyProperties.Add(
                TypeDescriptor.CreateProperty(
                thisType, prop, 
                new ReadOnlyAttribute(true))
                );
        }

        props = new PropertyDescriptorCollection(
            (PropertyDescriptor[])readOnlyProperties.ToArray(
            typeof(PropertyDescriptor))
            );
    }

    return props;
} 

Applies to

ICustomTypeDescriptor.GetProperties(Attribute[])

Returns the properties for the property grid, using the specified attribute array as a filter.

 virtual System::ComponentModel::PropertyDescriptorCollection ^ System.ComponentModel.ICustomTypeDescriptor.GetProperties(cli::array <Attribute ^> ^ attributes) = System::ComponentModel::ICustomTypeDescriptor::GetProperties;
System.ComponentModel.PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties (Attribute[] attributes);
Function GetProperties (attributes As Attribute()) As PropertyDescriptorCollection Implements ICustomTypeDescriptor.GetProperties

Parameters

attributes
Attribute[]

An array of Attribute objects with which to filter the properties.

Returns

An array of Attribute objects that represents the properties of the property grid that match the given set of attributes.

Implements

Examples

The following example duplicates the <xref:Microsoft.Web.Management.Client.PropertyGridObject.System.ComponentModel.ICustomTypeDescriptor.GetProperties%28System.Attribute%5B%5D%29> overload.

private PropertyDescriptorCollection MyGetPropertiesImpl(
    Attribute[] attributes) {
    PropertyDescriptorCollection props = 
        GetProperties(attributes);

    if (ReadOnly) {
        Type thisType = GetType();
        ArrayList readOnlyProperties = new ArrayList();
        foreach (PropertyDescriptor prop in props) {
            readOnlyProperties.Add(
                TypeDescriptor.CreateProperty(
                thisType, prop, 
                new ReadOnlyAttribute(true))
                );
        }

        props = new PropertyDescriptorCollection(
            (PropertyDescriptor[])readOnlyProperties.ToArray(
            typeof(PropertyDescriptor))
            );
    }

    return props;
} 

Applies to