public static Optional <object> Get(TransientObjectType key)
        {
            object obj;

            localObjectsById.TryGetValue(key, out obj);
            return(Optional.OfNullable(obj));
        }
        public static Optional <object> Get(TransientObjectType key)
        {
            if (localObjectsById.ContainsKey(key))
            {
                return(Optional <object> .OfNullable(localObjectsById[key]));
            }

            return(Optional <object> .Empty());
        }
        public static T Require <T>(TransientObjectType key)
        {
            if (!localObjectsById.TryGetValue(key, out object obj))
            {
                throw new Exception("Did not have an entry for key: " + key);
            }

            return((T)obj);
        }
 public static void Add(TransientObjectType key, object o)
 {
     localObjectsById[key] = o;
 }
 public static void Remove(TransientObjectType key)
 {
     localObjectsById.Remove(key);
 }
Пример #6
0
 /// <summary>
 /// Instantiates an LGSPTransientObject object.
 /// </summary>
 /// <param name="transientObjectType">The transient object type.</param>
 protected LGSPTransientObject(TransientObjectType transientObjectType)
 {
     lgspType = transientObjectType;
 }