Class SFArrayList
Extends ArrayList with MoveRange, InsertRange and RemoveRange methods. The Item property will grow the array on demand or return NULL if an index is out of range.
Implements
Inherited Members
Namespace: Syncfusion.Collections
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class SFArrayList : ArrayList, IList, ICollection, IEnumerable, ICloneable
Constructors
SFArrayList()
Overloaded. Initializes a new instance of the SFArrayList class that is empty and has the default initial capacity.
Declaration
public SFArrayList()
SFArrayList(ICollection)
Initializes a new instance of the SFArrayList class that contains elements copied from the specified collection and has the same initial capacity as the number of elements copied.
Declaration
public SFArrayList(ICollection c)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.ICollection | c | The System.Collections.ICollection whose elements are copied to the new list. |
Properties
Item[Int32]
Gets / sets the element at the specified index. In C#, this property is the indexer for the SFArrayList class.
Declaration
public override object this[int index] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the element to get / set. |
Property Value
Type | Description |
---|---|
System.Object | The element at the specified index. When querying the value and the index is out of range, an empty (null) object will be returned. When setting the value and the index is out of range the array will be enlarged. See EnsureCount(Int32) |
Overrides
Methods
Clone()
Overridden. Creates a deep copy of the SFArrayList.
Declaration
public override object Clone()
Returns
Type | Description |
---|---|
System.Object | A deep copy of the SFArrayList. |
Overrides
EnsureCount(Int32)
Enlarges the array if needed.
Declaration
public void EnsureCount(int value)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | value | The size to be checked. If the array has less elements, empty (null) objects will be appended at the end of the array. |
InsertRange(Int32, Int32)
Inserts a specified number of (null) values in the SFArrayList at a given index.
Declaration
public void InsertRange(int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the first value to be inserted. |
System.Int32 | count | The number of values in the range to be added. |
Examples
SFArrayList array = new SFArrayList();
array[0] = 0;
array[1] = 1;
array[2] = 2;
array[3] = 3;
array.InsertRange(1, 2);
// results in new order: 0, null, null, 2, 3
MoveRange(Int32, Int32, Int32)
Rearranges the values in the SFArrayList.
Declaration
public void MoveRange(int index, int count, int dest)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the first value to be moved. |
System.Int32 | count | The number of values in the range to be moved. |
System.Int32 | dest | The new starting index for the range. The zero-based index is based on the original array. |
Examples
SFArrayList array = new SFArrayList();
array[0] = 0;
array[1] = 1;
array[2] = 2;
array[3] = 3;
array.MoveRange(0, 2, 3);
// results in new order: 2, 0, 1, 3
RemoveRange(Int32, Int32)
Removes a range of values from the SFArrayList.
Declaration
public override void RemoveRange(int index, int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | index | The zero-based index of the first value to be removed. |
System.Int32 | count | The number of values in the range to be removed. |
Overrides
Examples
SFArrayList array = new SFArrayList();
array[0] = 0;
array[1] = 1;
array[2] = 2;
array[3] = 3;
array.RemoveRange(1, 2);
// results in new order: 0, 3