2018-10-15 19:33:06 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
2018-12-31 09:59:35 +00:00
|
|
|
|
namespace Elsa.Models
|
2018-10-15 19:33:06 +00:00
|
|
|
|
{
|
|
|
|
|
|
public class Variables : Dictionary<string, object>
|
|
|
|
|
|
{
|
2018-10-16 10:41:12 +00:00
|
|
|
|
public static readonly Variables Empty = new Variables();
|
2018-12-19 08:48:12 +00:00
|
|
|
|
|
2019-06-27 20:55:55 +00:00
|
|
|
|
public Variables()
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Variables(Variables other)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var variable in other)
|
|
|
|
|
|
{
|
|
|
|
|
|
this[variable.Key] = variable.Value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2018-12-19 08:48:12 +00:00
|
|
|
|
public object GetVariable(string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ContainsKey(name) ? this[name] : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public T GetVariable<T>(string name)
|
|
|
|
|
|
{
|
|
|
|
|
|
return ContainsKey(name) ? (T)this[name] : default(T);
|
|
|
|
|
|
}
|
2018-10-15 19:33:06 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|