Table of Contents

Class SingleUseTypeDictionary<TType>

Namespace
Uncreated.Warfare.Util.List
Assembly
Uncreated.Warfare.dll

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

types Type[]
values TType[]

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

t Type
context TContext

Returns

object

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

context TContext

Returns

TValueType

Type Parameters

TValueType
TContext

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

t Type
value object

Returns

bool

TryGet<TValueType>(out TValueType?)

Retreives the component using a given type.

public bool TryGet<TValueType>(out TValueType? value) where TValueType : TType

Parameters

value TValueType

Returns

bool

Type Parameters

TValueType