Class TurnContextStateCollection
Values persisted for the lifetime of the turn as part of the ITurnContext.
public class TurnContextStateCollection : Dictionary<string, object>, IDictionary<string, object>, ICollection<KeyValuePair<string, object>>, IDictionary, ICollection, IReadOnlyDictionary<string, object>, IReadOnlyCollection<KeyValuePair<string, object>>, IEnumerable<KeyValuePair<string, object>>, IEnumerable, ISerializable, IDeserializationCallback, IDisposable
- Inheritance
-
TurnContextStateCollection
- Implements
- Inherited Members
Constructors
TurnContextStateCollection()
Initializes a new instance of the TurnContextStateCollection class.
public TurnContextStateCollection()
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Dispose(bool)
Frees resources if the disposing parameter is set to true.
protected virtual void Dispose(bool disposing)
Parameters
disposing
boolBoolean value that indicates if freeing resources should be performed.
Get<T>()
Gets the default value by type from the turn's context.
public T Get<T>() where T : class
Returns
- T
The object; or null if no default service of the type is registered.
Type Parameters
T
The type of the object.
Remarks
The default service key is the FullName of the object type.
Get<T>(string)
Gets a cached value by name from the turn's context.
public T Get<T>(string key)
Parameters
key
stringThe name of the object.
Returns
- T
The object; or null if no service is registered by the key, or the retrieved object does not match the object type.
Type Parameters
T
The type of the object.
Exceptions
- ArgumentNullException
key
is null.
Has(string)
public bool Has(string key)
Parameters
key
string
Returns
Set<T>(string, T)
Set a value to the turn's context.
public void Set<T>(string key, T value)
Parameters
key
stringThe name of the object.
value
TThe value to add.
Type Parameters
T
The type of the object.
Exceptions
- ArgumentNullException
key
orvalue
is null.
Set<T>(T)
Set a value to the turn's context.
public void Set<T>(T value) where T : class
Parameters
value
TThe value to add.
Type Parameters
T
The type of the object.
Exceptions
- ArgumentNullException
value
is null.