public override bool Equals(object other) { if (other is DataTablePropertyDescriptor) { DataTablePropertyDescriptor descriptor = (DataTablePropertyDescriptor)other; return(descriptor.Table == Table); } return(false); }
public override bool Equals([NotNullWhen(true)] object?other) { if (other is DataTablePropertyDescriptor) { DataTablePropertyDescriptor descriptor = (DataTablePropertyDescriptor)other; return(descriptor.Table == Table); } return(false); }
/// <include file='doc\DataViewManagerListItemTypeDescriptor.uex' path='docs/doc[@for="DataViewManagerListItemTypeDescriptor.ICustomTypeDescriptor.GetProperties1"]/*' /> /// <devdoc> /// 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. /// </devdoc> PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { if (propsCollection == null) { PropertyDescriptor[] props = null; DataSet dataSet = dataViewManager.DataSet; if (dataSet != null) { int tableCount = dataSet.Tables.Count; props = new PropertyDescriptor[tableCount]; for (int i = 0; i < tableCount; i++) { props[i] = new DataTablePropertyDescriptor(dataSet.Tables[i]); } } propsCollection = new PropertyDescriptorCollection(props); } return(propsCollection); }
internal PropertyDescriptorCollection GetPropertiesInternal() { if (_propsCollection == null) { PropertyDescriptor[]? props = null; DataSet?dataSet = _dataViewManager.DataSet; if (dataSet != null) { int tableCount = dataSet.Tables.Count; props = new PropertyDescriptor[tableCount]; for (int i = 0; i < tableCount; i++) { props[i] = new DataTablePropertyDescriptor(dataSet.Tables[i]); } } _propsCollection = new PropertyDescriptorCollection(props); } return(_propsCollection); }
public PropertyDescriptorCollection GetProperties() { DataSet ds = dvm.DataSet; if (ds == null) { return(null); } DataTableCollection tables = ds.Tables; int index = 0; PropertyDescriptor [] descriptors = new PropertyDescriptor [tables.Count]; foreach (DataTable table in tables) { descriptors [index++] = new DataTablePropertyDescriptor(table); } return(new PropertyDescriptorCollection(descriptors)); }
private ListChangedEventArgs CollectionToListChangeEventArgs(CollectionChangeEventArgs e) { ListChangedEventArgs args; if (e.Action == CollectionChangeAction.Remove) { args = null; } else if (e.Action == CollectionChangeAction.Refresh) { args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorChanged, null); } else { object obj; if (typeof(DataTable).IsAssignableFrom(e.Element.GetType())) { obj = new DataTablePropertyDescriptor((DataTable)e.Element); } else // Assume a DataRelation { obj = new DataRelationPropertyDescriptor((DataRelation)e.Element); } if (e.Action == CollectionChangeAction.Add) { args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorAdded, (PropertyDescriptor)obj); } else { args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorDeleted, (PropertyDescriptor)obj); } } return(args); }
private ListChangedEventArgs CollectionToListChangeEventArgs (CollectionChangeEventArgs e) { ListChangedEventArgs args; if (e.Action == CollectionChangeAction.Remove) args = null; else if (e.Action == CollectionChangeAction.Refresh) args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorChanged, null); else { object obj; if (typeof (DataTable).IsAssignableFrom (e.Element.GetType())) obj = new DataTablePropertyDescriptor ((DataTable) e.Element); else // Assume a DataRelation obj = new DataRelationPropertyDescriptor((DataRelation) e.Element); if (e.Action == CollectionChangeAction.Add) args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorAdded, (PropertyDescriptor) obj); else args = new ListChangedEventArgs(ListChangedType.PropertyDescriptorDeleted, (PropertyDescriptor) obj); } return args; }
PropertyDescriptorCollection ICustomTypeDescriptor.GetProperties(Attribute[] attributes) { if (this.propsCollection == null) { PropertyDescriptor[] properties = null; DataSet dataSet = this.dataViewManager.DataSet; if (dataSet != null) { int count = dataSet.Tables.Count; properties = new PropertyDescriptor[count]; for (int i = 0; i < count; i++) { properties[i] = new DataTablePropertyDescriptor(dataSet.Tables[i]); } } this.propsCollection = new PropertyDescriptorCollection(properties); } return this.propsCollection; }
public PropertyDescriptorCollection GetProperties () { DataSet ds = dvm.DataSet; if (ds == null) return null; DataTableCollection tables = ds.Tables; int index = 0; PropertyDescriptor [] descriptors = new PropertyDescriptor [tables.Count]; foreach (DataTable table in tables) descriptors [index++] = new DataTablePropertyDescriptor (table); return new PropertyDescriptorCollection (descriptors); }