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?>>, IEnumerableInheritance #
Implements #
IDictionary<string, object?>, ICollection<KeyValuePair<string, object?>>, IEnumerable<KeyValuePair<string, object?>>, IEnumerable
Inherited Members #
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors #
| Name | Description |
|---|---|
| TypedValueDictionary() | Creates an new TypedValueDictionary instance with default parameters. |
| TypedValueDictionary(StringComparer) | Creates an new TypedValueDictionary instance with default parameters with the specified StringComparer. |
Methods #
| Name | Description |
|---|---|
| Get<T>() | Gets a singleton previously defined in this context bag via it’s type T. |
| 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 provided getter function. |
| GetOrAdd<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 by creating a new instance of T. |
| 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 asynchronous getter 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. |
| GetValue(string) | Gets the value associated with the specified key. |
| GetValue<T>(string) | Gets the value associated with the specified key, and converts it to the specified type. |
| 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. |
| SetValue(string, object?) | Sets the value associated with the specified key. |
| 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. |