In This Article

KeysCollection Class

Provides a collection of Keys values.

public class KeysCollection : CollectionBase
Inheritance:
object CollectionBase object

Constructors

KeysCollection()

Initializes an instance of the class.

public KeysCollection()

Properties

this[int]

Gets or sets the Keys at the specified index.

[C#] In C#, this property is the indexer for the KeysCollection class.

public Keys this[int index] { get; }
Parameter Type Description
index int

The index of the Keys to return.

Property Value

Keys:

The Keys at the specified index.

Methods

Add(Keys)

Adds a Keys to the end of the collection.

public int Add(Keys value)
Parameter Type Description
value Keys

The Keys to be added to the end of the collection.

Returns

int:

The collection index at which the Keys has been added.

Contains(Keys)

Returns whether the specified Keys is in the collection.

public virtual bool Contains(Keys value)
Parameter Type Description
value Keys

The Keys to locate in the collection.

Returns

bool:

true if the Keys is found in the collection; otherwise, false.

IndexOf(Keys)

Searches for the specified Keys and returns the zero-based index of the first occurrence within the entire collection.

public virtual int IndexOf(Keys value)
Parameter Type Description
value Keys

The Keys to locate in the collection.

Returns

int:

The zero-based index of the first occurrence of the Keys within the entire collection, if found; otherwise, -1.

Remove(Keys)

Removes the first occurrence of a specific Keys from the collection.

public void Remove(Keys value)
Parameter Type Description
value Keys

The Keys to remove from the collection.

Remarks

The elements that follow the removed element move up to occupy the vacated spot. The indexes of the elements that are moved are also updated.

Inherited Members