Method GetValue
GetValue<T>(string, T)
Gets the value of a variable of a specified type, returning a default value if the variable is not found.
Declaration
T GetValue<T>(string variableName, T defaultValue)
Parameters
| Type | Name | Description |
|---|---|---|
| string | variableName | The name of the variable. |
| T | defaultValue | The default value to return if the variable is not found. |
Returns
| Type | Description |
|---|---|
| T | The value of the variable if found; otherwise, |
Type Parameters
| Name | Description |
|---|---|
| T | The expected type of the variable's value. |
GetValue<T>(string)
Gets the value of a variable of a specified type. Throws an exception if the variable is not found.
Declaration
T GetValue<T>(string variableName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | variableName | The name of the variable. |
Returns
| Type | Description |
|---|---|
| T | The value of the variable. |
Type Parameters
| Name | Description |
|---|---|
| T | The expected type of the variable's value. |
Exceptions
| Type | Condition |
|---|---|
| KeyNotFoundException | Thrown if the variable is not found. |