System.Data.DataView.ITypedList C# (CSharp) Method

ITypedList() private method

private ITypedList ( PropertyDescriptor listAccessors ) : PropertyDescriptorCollection
listAccessors System.ComponentModel.PropertyDescriptor
return System.ComponentModel.PropertyDescriptorCollection
		PropertyDescriptorCollection ITypedList.GetItemProperties (PropertyDescriptor [] listAccessors)
		{
			if (dataTable == null)
				return new PropertyDescriptorCollection (new PropertyDescriptor [0]);

			// FIXME: use listAccessors somehow
			PropertyDescriptor [] descriptors =
				new PropertyDescriptor [dataTable.Columns.Count + dataTable.ChildRelations.Count];

			int d = 0;
			for (int col = 0; col < dataTable.Columns.Count; col ++) {
				DataColumn dataColumn = dataTable.Columns[col];
				DataColumnPropertyDescriptor descriptor;

				descriptor = new DataColumnPropertyDescriptor (dataColumn.ColumnName, col, null);
				descriptor.SetComponentType (typeof (System.Data.DataRowView));
				descriptor.SetPropertyType (dataColumn.DataType);
				descriptor.SetReadOnly (dataColumn.ReadOnly);
				descriptor.SetBrowsable (dataColumn.ColumnMapping != MappingType.Hidden);
				descriptors [d++] = descriptor;
			}
			for (int rel = 0; rel < dataTable.ChildRelations.Count; rel ++) {
				DataRelation dataRelation = dataTable.ChildRelations [rel];
				DataRelationPropertyDescriptor descriptor;

				descriptor = new DataRelationPropertyDescriptor (dataRelation);
				descriptors [d++] = descriptor;
			}

			return new PropertyDescriptorCollection (descriptors);
		}