Class DataTableWrapperList
An IBindingList that wraps a DataTable and provides optimized access to the rows of the datatable. Assign this list to a grid as DataSource to improve performance when inserting records into an existing table with many records.
Inheritance
Implements
Inherited Members
Namespace: Syncfusion.Collections
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class DataTableWrapperList : IBindingList, IList, ICollection, IEnumerable, ITypedList
Constructors
DataTableWrapperList(DataTable)
Initializes a new object and attaches it to the wrapped DataTable.
Declaration
public DataTableWrapperList(DataTable dt)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataTable | dt | The DataTable to be wrapped. |
Fields
ChangedRowIndex
Declaration
public static int ChangedRowIndex
Field Value
Type |
---|
System.Int32 |
Properties
AllowEdit
Always True.
Declaration
public bool AllowEdit { get; }
Property Value
Type |
---|
System.Boolean |
AllowNew
Always True.
Declaration
public bool AllowNew { get; }
Property Value
Type |
---|
System.Boolean |
AllowRemove
Always True.
Declaration
public bool AllowRemove { get; }
Property Value
Type |
---|
System.Boolean |
Count
Returns the number of elements contained in the collection.
Declaration
public int Count { get; }
Property Value
Type |
---|
System.Int32 |
DataTable
The underlying DataTable.
Declaration
public DataTable DataTable { get; }
Property Value
Type |
---|
System.Data.DataTable |
IsReadOnly
Always False.
Declaration
public bool IsReadOnly { get; }
Property Value
Type |
---|
System.Boolean |
IsSorted
Always False.
Declaration
public bool IsSorted { get; }
Property Value
Type |
---|
System.Boolean |
IsSynchronized
Not implemented.
Declaration
public bool IsSynchronized { get; }
Property Value
Type |
---|
System.Boolean |
Item[Int32]
Returns the element at the zero-based index. Setting is not supported and will throw an exception since the collection is Read-only.
Declaration
public object this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index |
Property Value
Type |
---|
System.Object |
SortDirection
Not implemented.
Declaration
public ListSortDirection SortDirection { get; }
Property Value
Type |
---|
System.ComponentModel.ListSortDirection |
SortProperty
Not implemented.
Declaration
public PropertyDescriptor SortProperty { get; }
Property Value
Type |
---|
System.ComponentModel.PropertyDescriptor |
SupportsChangeNotification
Always True.
Declaration
public bool SupportsChangeNotification { get; }
Property Value
Type |
---|
System.Boolean |
SupportsSearching
Always False.
Declaration
public bool SupportsSearching { get; }
Property Value
Type |
---|
System.Boolean |
SupportsSorting
Always False.
Declaration
public bool SupportsSorting { get; }
Property Value
Type |
---|
System.Boolean |
SyncRoot
Not implemented.
Declaration
public object SyncRoot { get; }
Property Value
Type |
---|
System.Object |
Methods
Add(Object)
Adds a row object to the end of the collection.
Declaration
public int Add(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The element to be added to the end of the collection. The value must not be a NULL reference (Nothing in Visual Basic). |
Returns
Type | Description |
---|---|
System.Int32 | The zero-based collection index at which the value has been added. |
AddIndex(PropertyDescriptor)
Not implemented.
Declaration
public void AddIndex(PropertyDescriptor property)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property |
AddNew()
Adds a new row (calling DataTable.NewRow) and returns the new object.
Declaration
public object AddNew()
Returns
Type |
---|
System.Object |
Clear()
Removes all elements from the collection.
Declaration
public void Clear()
CopyTo(Array, Int32)
Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.
Declaration
public void CopyTo(Array array, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Array | array | The one-dimensional array that is the destination of the elements copied from the ArrayList. The array must have zero-based indexing. |
System.Int32 | index | The zero-based index in an array at which copying begins. |
Find(PropertyDescriptor, Object)
Not implemented. Returns -1.
Declaration
public int Find(PropertyDescriptor property, object key)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property | |
System.Object | key |
Returns
Type |
---|
System.Int32 |
GetDataTableRowIndexOf(DataRow)
Declaration
public static int GetDataTableRowIndexOf(DataRow row)
Parameters
Type | Name | Description |
---|---|---|
System.Data.DataRow | row |
Returns
Type |
---|
System.Int32 |
GetEnumerator()
Returns an enumerator.
Declaration
public IEnumerator GetEnumerator()
Returns
Type |
---|
System.Collections.IEnumerator |
GetItemProperties(PropertyDescriptor[])
Returns a PropertyDescriptorCollection that represents the DataTable.Columns collection.
Declaration
public PropertyDescriptorCollection GetItemProperties(PropertyDescriptor[] listAccessors)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor[] | listAccessors |
Returns
Type |
---|
System.ComponentModel.PropertyDescriptorCollection |
GetListName(PropertyDescriptor[])
Returns DataTable.TableName.
Declaration
public string GetListName(PropertyDescriptor[] listAccessors)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor[] | listAccessors |
Returns
Type |
---|
System.String |
Insert(Int32, Object)
Inserts an element into the collection at the specified index.
Declaration
public void Insert(int index, object value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index at which the element should be inserted. |
System.Object | value | The element to insert. The value must not be a NULL reference (Nothing in Visual Basic). |
Remove(Object)
Removes the specified row object from the collection.
Declaration
public void Remove(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value | The element to remove from the collection. If the value is NULL or the element is not contained in the collection, the method will do nothing. |
RemoveAt(Int32)
Removes the element at the specified index of the collection.
Declaration
public void RemoveAt(int index)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to remove. |
RemoveIndex(PropertyDescriptor)
Not implemented.
Declaration
public void RemoveIndex(PropertyDescriptor property)
Parameters
Type | Name | Description |
---|---|---|
System.ComponentModel.PropertyDescriptor | property |
RemoveSort()
Not implemented.
Declaration
public void RemoveSort()
Events
ListChanged
Broadcasts the System.ComponentModel.IBindingList.ListChanged event.
Declaration
public event ListChangedEventHandler ListChanged
Event Type
Type |
---|
System.ComponentModel.ListChangedEventHandler |
Explicit Interface Implementations
IList.Contains(Object)
Always False, the method is not implemented yet.
Declaration
bool IList.Contains(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type |
---|
System.Boolean |
IList.IndexOf(Object)
Always -1, the method is not implemented.
Declaration
int IList.IndexOf(object value)
Parameters
Type | Name | Description |
---|---|---|
System.Object | value |
Returns
Type |
---|
System.Int32 |
IList.IsFixedSize
Always False since this collection has no fixed size.
Declaration
bool IList.IsFixedSize { get; }
Returns
Type |
---|
System.Boolean |