Class KeyBasedCollection<TKey, TValue>
A KeyBasedCollection<TKey, TValue> implementation with support for deep equality.
Inheritance
Implements
Namespace: Sdl.Core.Bcm.BcmModel.Collections
Assembly: Sdl.Core.Bcm.BcmModel.dll
Syntax
public class KeyBasedCollection<TKey, TValue> : KeyedCollection<TKey, TValue>
Type Parameters
Name | Description |
---|---|
TKey | The key. |
TValue | The value. |
Constructors
KeyBasedCollection()
Initializes a new instance of the KeyBasedCollection<TKey, TValue> class.
Declaration
protected KeyBasedCollection()
KeyBasedCollection(Func<TValue, TKey>)
Initializes a new instance of the KeyBasedCollection<TKey, TValue> class.
Declaration
public KeyBasedCollection(Func<TValue, TKey> keySelector)
Parameters
Type | Name | Description |
---|---|---|
System.Func<TValue, TKey> | keySelector | The key selector. |
Fields
KeySelector
The key selector.
Declaration
protected Func<TValue, TKey> KeySelector
Field Value
Type | Description |
---|---|
System.Func<TValue, TKey> |
Methods
Equals(KeyBasedCollection<TKey, TValue>)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(KeyBasedCollection<TKey, TValue> other)
Parameters
Type | Name | Description |
---|---|---|
KeyBasedCollection<TKey, TValue> | other | An object to compare with this object. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current object is equal to the |
Equals(Object)
Performs a deep-equals comparison.
System.Object.Equals(object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
ForEach(Action<TValue>)
Executes an action over each element of the collection.
Declaration
public void ForEach(Action<TValue> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<TValue> | action | The action. |
GetHashCode()
Returns a hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | A hash code for this instance. |
GetKeyForItem(TValue)
When implemented in a derived class, extracts the key from the specified element.
Declaration
protected override TKey GetKeyForItem(TValue item)
Parameters
Type | Name | Description |
---|---|---|
TValue | item | The element from which to extract the key. |
Returns
Type | Description |
---|---|
TKey | The key for the specified element. |