Show / Hide Table of Contents

Class EnhancedKeyedCollection<T1, T2>

Hastable based collection which can be accessed by index or key. Derive and override GetKeyForItem() to use. If serialization is required use KeyedCollectionConverter.

Inheritance
Object
Collection<T2>
KeyedCollection<T1, T2>
EnhancedKeyedCollection<T1, T2>
KeyCollection
SectionCollection
ImmediateKeyedCollection<T1, T2>
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public abstract class EnhancedKeyedCollection<T1, T2> : KeyedCollection<T1, T2>, IList<T2>, ICollection<T2>, IReadOnlyList<T2>, IReadOnlyCollection<T2>, IEnumerable<T2>, IList, ICollection, IEnumerable where T2 : class
Type Parameters
Name Description
T1
T2

Constructors

| Improve this Doc View Source

EnhancedKeyedCollection()

Make a new collection whose keys are embedded in the values. Lookup dictionary is created immediately.

Declaration
public EnhancedKeyedCollection()
| Improve this Doc View Source

EnhancedKeyedCollection(IEqualityComparer<T1>)

Make a new collection whose keys are embedded in the values. Lookup dictionary is created immediately.

Declaration
public EnhancedKeyedCollection(IEqualityComparer<T1> comparer)
Parameters
Type Name Description
IEqualityComparer<T1> comparer

Equality comparer (null to use default).

| Improve this Doc View Source

EnhancedKeyedCollection(IEqualityComparer<T1>, Int32)

Make a new collection whose keys are embedded in the values.

Declaration
public EnhancedKeyedCollection(IEqualityComparer<T1> comparer, int dictionaryCreationThreshold)
Parameters
Type Name Description
IEqualityComparer<T1> comparer

Equality comparer (null to used default).

Int32 dictionaryCreationThreshold

Lookup dictionary is created when Count is this number.

Methods

| Improve this Doc View Source

GetValueOrDefault(T1)

Gets a value from the collection or null. This is O(1) if lookup dictionary is created, otherwise is O(n).

Declaration
public virtual T2 GetValueOrDefault(T1 key)
Parameters
Type Name Description
T1 key
Returns
Type Description
T2
| Improve this Doc View Source

SetItem(Int32, T2)

Declaration
protected override void SetItem(int index, T2 item)
Parameters
Type Name Description
Int32 index
T2 item
Overrides
System.Collections.ObjectModel.KeyedCollection<T1, T2>.SetItem(System.Int32, T2)
| Improve this Doc View Source

TryGetValue(T1, out T2)

Seeks a value from the collection. This is O(1) if lookup dictionary is created, otherwise is O(n).

Declaration
public virtual bool TryGetValue(T1 key, out T2 item)
Parameters
Type Name Description
T1 key
T2 item
Returns
Type Description
Boolean
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX