Class OneToManyRelation<TKey, TValue>
- Namespace
- AsmResolver.Collections
- Assembly
- AsmResolver.dll
Represents a one-to-many relation, where an object is mapped to a collection of other objects.
public sealed class OneToManyRelation<TKey, TValue> where TKey : notnull where TValue : notnull
Type Parameters
TKeyThe type of objects to map.
TValueThe type of objects to map to.
- Inheritance
-
OneToManyRelation<TKey, TValue>
- Inherited Members
Constructors
OneToManyRelation()
Creates a new, empty one-to-many relation mapping.
public OneToManyRelation()
OneToManyRelation(int)
Creates a new, empty one-to-many relation mapping.
public OneToManyRelation(int capacity)
Parameters
capacityintThe initial number of elements the relation can store.
Methods
Add(TKey, TValue)
Registers a relation between two objects.
public bool Add(TKey key, TValue value)
Parameters
keyTKeyThe first object.
valueTValueThe second object to map to.
Returns
- bool
trueif the key value pair was successfully registered.falseif there already exists a key that maps to the provided value.
GetKey(TValue)
Gets the key that maps to the provided value.
public TKey? GetKey(TValue value)
Parameters
valueTValueThe value.
Returns
- TKey
The key.
GetValues(TKey)
Gets a collection of values the provided key maps to.
public OneToManyRelation<TKey, TValue>.ValueSet GetValues(TKey key)
Parameters
keyTKeyThe key.
Returns
- OneToManyRelation<TKey, TValue>.ValueSet
The values.