Class StateVariable<T>
Wrapper class for any object that maps string key onto the object value (like
Namespace: DotNetNuke.Common.Utilities
Assembly: DotNetNuke.dll
Syntax
public abstract class StateVariable<T> : object
Type Parameters
Name | Description |
---|---|
T | The type of the variable's value. |
Constructors
| Improve this Doc View SourceStateVariable(String, Func<T>)
Initializes a new instance of the StateVariable<T> class. Initializes a new item variable with a initializer.
Declaration
protected StateVariable(string key, Func<T> initializer)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to use for storing the value in the dictionary. |
Func<T> | initializer | A function that is called in order to create a default value per dictionary. |
StateVariable(String)
Initializes a new instance of the StateVariable<T> class. Initializes a new item variable.
Declaration
protected StateVariable(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | The key to use for storing the value in the items. |
Properties
| Improve this Doc View SourceHasValue
Gets a value indicating whether indicates wether there is a value present or not.
Declaration
public bool HasValue { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Item[String]
Get/sets the value in associated dictionary/map.
Declaration
protected abstract object this[string key] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Value key. |
Property Value
Type | Description |
---|---|
System.Object | The value. |
Value
Gets or sets or gets the value in the current items.
Declaration
public T Value { get; set; }
Property Value
Type | Description |
---|---|
T |
ValueOrDefault
Gets the value in the current items or if none is available default(T)
.
Declaration
public T ValueOrDefault { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceClear()
Clears the value in the current items.
Declaration
public void Clear()
Remove(String)
Removes the value in associated dictionary according.
Declaration
protected abstract void Remove(string key)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Value key. |