System.Data.DataTable.GetPropertyDescriptorCollection C# (CSharp) Method

GetPropertyDescriptorCollection() private method

Retrieves an array of properties that the given component instance provides. This may differ from the set of properties the class provides. If the component is sited, the site may add or remove additional properties. The returned array of properties will be filtered by the given set of attributes.
private GetPropertyDescriptorCollection ( Attribute attributes ) : PropertyDescriptorCollection
attributes Attribute
return PropertyDescriptorCollection
        internal PropertyDescriptorCollection GetPropertyDescriptorCollection(Attribute[] attributes)
        {
            if (_propertyDescriptorCollectionCache == null)
            {
                int columnsCount = Columns.Count;
                int relationsCount = ChildRelations.Count;
                PropertyDescriptor[] props = new PropertyDescriptor[columnsCount + relationsCount];
                {
                    for (int i = 0; i < columnsCount; i++)
                    {
                        props[i] = new DataColumnPropertyDescriptor(Columns[i]);
                    }
                    for (int i = 0; i < relationsCount; i++)
                    {
                        props[columnsCount + i] = new DataRelationPropertyDescriptor(ChildRelations[i]);
                    }
                }
                _propertyDescriptorCollectionCache = new PropertyDescriptorCollection(props);
            }
            return _propertyDescriptorCollectionCache;
        }

Usage Example

Example #1
0
        PropertyDescriptorCollection System.ComponentModel.ITypedList.GetItemProperties(PropertyDescriptor[] listAccessors) {
            DataSet dataSet = DataSet;
            if (dataSet == null)
                throw ExceptionBuilder.CanNotUseDataViewManager();

            if (listAccessors == null || listAccessors.Length == 0) {
                return((ICustomTypeDescriptor)(new DataViewManagerListItemTypeDescriptor(this))).GetProperties();
            }
            else {
                DataTable table = dataSet.FindTable(null, listAccessors, 0);
                if (table != null) {
                    return table.GetPropertyDescriptorCollection(null);
                }
            }
            return new PropertyDescriptorCollection(null);
        }
All Usage Examples Of System.Data.DataTable::GetPropertyDescriptorCollection
DataTable