Property this
this[string]
Gets or sets the IVariable with the specified name.
Declaration
public IVariable this[string name] { get; set; }
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the variable. |
Property Value
Type | Description |
---|---|
IVariable | The found variable. |
Examples
This example shows how to get a variable group named "globals".
var source = LocalizationSettings.StringDatabase.SmartFormatter.GetSourceExtension<PersistentVariablesSource>();
var globalVariables = source["globals"];
var intVariable = new IntVariable { Value = 123 };
// This can be accessed from a Smart String with the following syntax: {globals.my-int}
globalVariables.Add("my-int", intVariable);
Exceptions
Type | Condition |
---|---|
KeyNotFoundException | Thrown if a variable with the specified name does not exist. |