DataSource for Entity Framework in WPF
C1.LiveLinq.Indexing Namespace / IndexDefinition<T> Class / KeyIsUnique Property

In This Topic
    KeyIsUnique Property
    In This Topic
    Gets a value that indicates whether the key used in this index is a unique key for the collection.
    Syntax
    'Declaration
     
    Public ReadOnly Property KeyIsUnique As Boolean
    public bool KeyIsUnique {get;}

    Property Value

    true if the key is unique; otherwise, false
    Remarks

    A unique index occupies less memory and performs better than a non-unique index (although the difference isn't dramatic). Therefore, for unique keys, it's recommended to specify the corresponding index as unique in the IndexCollection.Add method.

    But do that only if you are sure that the key is indeed unique, as it imposes a uniqueness constraint on the collection. An attempt to modify the collection violating the uniqueness throws an System.InvalidOperationException.

    See Also