State sets default value if get doesn't find it
Which allows for normal usage of Dictionaries inside state....
This commit is contained in:
parent
0351f2360e
commit
3f862f4137
|
|
@ -16,8 +16,16 @@ namespace Elsa
|
|||
{
|
||||
var item = state?.ContainsKey(key) == true ? state![key] : default;
|
||||
|
||||
if (item == null)
|
||||
return defaultValue();
|
||||
if (item == null)
|
||||
{
|
||||
if (state != null)
|
||||
{
|
||||
state.SetState(key, defaultValue());
|
||||
item = state![key];
|
||||
}
|
||||
else
|
||||
return defaultValue();
|
||||
}
|
||||
|
||||
return item.ConvertTo<T>()!;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue