示例#1
0
        /// <summary>Initializes the slot.</summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        internal void InitSlot(RunStateKey key, object value)
        {
            var initialized = _stateSlots.TryAdd(key, value);

            Code.AssertState(initialized, "Attempt to overwrite filled state slot.");
        }
示例#2
0
 public object GetSlot(RunStateKey key, Func <object> valueFactory) =>
 _stateSlots.GetOrAdd(key, _ => valueFactory());