Class TypedValueDictionary
Represents the base class for storing and retriving data by their type.
public class TypedValueDictionary : IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
- Inheritance
-
TypedValueDictionary
- Implements
- Inherited Members
Constructors
- TypedValueDictionary()
Creates an new TypedValueDictionary instance with default parameters.
- TypedValueDictionary(StringComparer)
Creates an new TypedValueDictionary instance with default parameters with the specified StringComparer.
Methods
- GetOrAddAsync<T>(Func<Task<T>>)
Asynchronously gets a singleton previously defined in this context bag via its type
T
. If it does not exist, it adds the object to the context bag using the provided asynchronousgetter
function.
- GetOrAdd<T>(Func<T>)
Gets a singleton previously defined in this context bag via its type
T
. If it does not exist, it adds the object to the context bag using the providedgetter
function.
- GetOrDefault<T>()
Gets a singleton previously defined in this context bag via its type
T
. Returns the default value if the object is not defined.
- GetTypeKeyName(Type)
Gets the Type full qualified key name.
- Get<T>()
Gets a singleton previously defined in this context bag via it's type
T
.
- IsSet<T>()
Determines whether the specified
T
singleton is defined in this context.
- IsSet<T>(out T)
Determines whether the specified
T
singleton is defined in this context and tries to output it.
- Set<T>()
Creates and adds an singleton of
T
in this context bag.
- Set<T>(T)
Adds an singleton of
T
in this context bag.
- TryGetValue<TResult>(string, out TResult?)
Gets the value associated with the specified key and casts it into
TResult
.
- Unset<T>()
Removes an singleton object from it's type
T
.