// ReSharper disable once CheckNamespace namespace Elsa.Extensions; static class ObjectDictionaryExtensions { public static T GetOrAdd(this IDictionary dictionary, object key, Func valueFactory) { if (dictionary.TryGetValue(key, out var value)) return (T)value; value = valueFactory(); dictionary.Add(key, value!); return (T)value!; } public static T Get(this IDictionary dictionary, object key) => (T)dictionary[key]; }