Class ColumnCollection
Represents a collection of Column instances.
public sealed class ColumnCollection : IList<Column>, ICollection<Column>, IEnumerable<Column>, IEnumerable
- Inheritance
-
ColumnCollection
- Implements
- Inherited Members
- Extension Methods
Constructors
ColumnCollection()
Initializes a new instance.
public ColumnCollection()
Remarks
Create a new empty collection that is not readonly.
Properties
Count
Gets the number of elements contained in the collection.
public int Count { get; }
Property Value
- int
The number of elements contained in the collection.
IsReadOnly
Gets a value indicating whether the collection is read-only.
public bool IsReadOnly { get; }
Property Value
- bool
trueif the collection is read-only; otherwise,false.
this[int]
Gets or sets the Column at the specified index.
public Column this[int index] { get; set; }
Parameters
indexintThe zero-based index of the ColumnHeader to get or set.
Property Value
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the collection.- NotSupportedException
The property is set and the collection is read-only.
this[string]
Gets the Column with the specified ColumnHeader name.
public Column this[string columnName] { get; }
Parameters
columnNamestringThe name of the ColumnHeader to get.
Property Value
Exceptions
- KeyNotFoundException
If this collection does not contain a ColumnHeader with the specified name.
Methods
Add(Column)
Adds the specified ColumnHeader to this collection.
public void Add(Column column)
Parameters
columnColumnThe ColumnHeader to add.
Exceptions
- NotSupportedException
The collection is read-only.
Clear()
Removes all items from the collection.
public void Clear()
Exceptions
- NotSupportedException
The collection is read-only.
Contains(Column)
Determines whether the collection contains the specified ColumnHeader.
public bool Contains(Column item)
Parameters
itemColumnThe ColumnHeader to locate in the collection.
Returns
- bool
trueifitemis found in the collection; otherwise,false.
Contains(string)
Determines whether this collection contains a Column with
the specified columnName.
public bool Contains(string columnName)
Parameters
columnNamestringName of the column.
Returns
- bool
<code>true</code> if this collection contains a <xref href="Ranorex.Column" data-throw-if-not-resolved="false"></xref> withthe specified
columnName; otherwise,false.
CopyTo(Column[], int)
public void CopyTo(Column[] array, int arrayIndex)
Parameters
arrayColumn[]The one-dimensional Array that is the destination of the elements copied from the collection. The Array must have zero-based indexing.
arrayIndexintThe zero-based index in
arrayat which copying begins.
Exceptions
- ArgumentNullException
arrayis null.- ArgumentOutOfRangeException
arrayIndexis less than 0.- ArgumentException
<code class="paramref">array</code> is multidimensional.-or-
arrayIndexis equal to or greater than the length ofarray. -or- The number of elements in the source collection is greater than the available space fromarrayIndexto the end of the destinationarray.
CreateCopy()
Creates a deep copy of this collection.
public ColumnCollection CreateCopy()
Returns
- ColumnCollection
A new ColumnHeader collection containing columns with the same name as the columns in this collection.
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Column> GetEnumerator()
Returns
- IEnumerator<Column>
An enumerator that can be used to iterate through the collection.
IndexOf(Column)
Determines the index of a specific ColumnHeader in the collection.
public int IndexOf(Column item)
Parameters
itemColumnThe ColumnHeader to locate in the collection.
Returns
- int
The index of
itemif found in the list; otherwise,-1.
IndexOf(string)
Determines the index of the ColumnHeader with the specified columnName
within this collection.
public int IndexOf(string columnName)
Parameters
columnNamestringThe name of the ColumnHeader to get the index of.
Returns
- int
The index of the ColumnHeader with the specified
columnNameif found in this collection; otherwise,-1.
Insert(int, Column)
Inserts a column at the specified index.
public void Insert(int index, Column column)
Parameters
indexintThe zero-based index at which the column should be inserted.
columnColumnThe column to insert into the collection.
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the collection.- NotSupportedException
The collection is read-only.
MakeReadOnly()
Makes this collection read only.
public void MakeReadOnly()
Remarks
This operation is irreversible.
Remove(Column)
Removes the first occurrence of the specified column.
public bool Remove(Column column)
Parameters
columnColumnThe ColumnHeader to remove from the collection.
Returns
- bool
trueif the ColumnHeader was successfully removed from the collection; otherwise,false. This method also returnsfalseif the ColumnHeader is not found in the original collection.
Exceptions
- NotSupportedException
The collection is read-only.
RemoveAt(int)
Removes the ColumnHeader at the specified index.
public void RemoveAt(int index)
Parameters
indexintThe zero-based index of the ColumnHeader to remove.
Exceptions
- ArgumentOutOfRangeException
indexis not a valid index in the collection.- NotSupportedException
The collection is read-only.