Infragistics(R) NetAdvantage(R) Windows Forms
Key Property
See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > RowLayout Class : Key Property

Returns or sets a value that uniquely identifies an object in a collection.

Syntax

Visual Basic (Declaration) 
Public Overrides ReadOnly Property Key As String
C# 
public override string Key {get;}

Remarks

The Key property is a unique, user-defined object identification string that can be used interchangeably with the Index of an object when accessing it through code. If you attempt to assign a value to the Key property is not unique in the collection, an error will occur.

The value of the Index property of an object can change when objects in the collection are reordered, such as when you add or remove objects. If you expect the Index property to change dynamically, refer to objects in a collection using the Key property. In addition, you can use the Key property to make your program "self-documenting" by assigning meaningful names to the objects in a collection.

You can set the Key property when you use the Add method to add an object to a collection. In some instances, the Key property of an object may be blank if that object does not appear in a collection.

Also, note that the uniqueness of keys is only enforced when the Key property is set to a value. If a collection supports objects with blank keys, that collection may contain multiple objects that whose Key property is empty. In that case, you must use Index property to differentiate between the objects that have blank keys.

See Also