System.Data.DataSet.FindTable C# (CSharp) Method

FindTable() private method

private FindTable ( DataTable baseTable, PropertyDescriptor props, int propStart ) : DataTable
baseTable DataTable
props System.ComponentModel.PropertyDescriptor
propStart int
return DataTable
        internal DataTable FindTable(DataTable baseTable, PropertyDescriptor[] props, int propStart)
        {
            if (props.Length < propStart + 1)
            {
                return baseTable;
            }

            PropertyDescriptor currentProp = props[propStart];

            if (baseTable == null)
            {
                // the accessor is the table name.  if we don't find it, return null.
                if (currentProp is DataTablePropertyDescriptor)
                {
                    return FindTable(((DataTablePropertyDescriptor)currentProp).Table, props, propStart + 1);
                }
                return null;
            }

            if (currentProp is DataRelationPropertyDescriptor)
            {
                return FindTable(((DataRelationPropertyDescriptor)currentProp).Relation.ChildTable, props, propStart + 1);
            }

            return null;
        }

Usage Example

Beispiel #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.DataSet::FindTable