Class SingleUseTypeDictionary<TType>
Fast type-to-object dictionary that can only be used once per type and type list.
public class SingleUseTypeDictionary<TType> where TType : notnull
Type Parameters
TType
- Inheritance
-
SingleUseTypeDictionary<TType>
- Inherited Members
Constructors
SingleUseTypeDictionary()
public SingleUseTypeDictionary()
SingleUseTypeDictionary(Type[], TType[])
public SingleUseTypeDictionary(Type[] types, TType[] values)
Parameters
typesType[]valuesTType[]
Properties
Values
List of all values in order of their types.
public TType[] Values { get; }
Property Value
- TType[]
Methods
Get<TContext>(Type, TContext)
Retreives the component using a given type.
public object Get<TContext>(Type t, TContext context) where TContext : notnull
Parameters
tTypecontextTContext
Returns
Type Parameters
TContext
Exceptions
- ComponentNotFoundException
Thrown when the component isn't found.
Get<TValueType, TContext>(TContext)
Retreives the component using a given type.
public TValueType Get<TValueType, TContext>(TContext context) where TValueType : TType where TContext : notnull
Parameters
contextTContext
Returns
- TValueType
Type Parameters
TValueTypeTContext
Exceptions
- ComponentNotFoundException
Thrown when the component isn't found.
TryGet(Type, out object?)
Retreives the component using a given type.
public bool TryGet(Type t, out object? value)
Parameters
Returns
TryGet<TValueType>(out TValueType?)
Retreives the component using a given type.
public bool TryGet<TValueType>(out TValueType? value) where TValueType : TType
Parameters
valueTValueType
Returns
Type Parameters
TValueType