Example #1
0
 public ISimObject As(Type t)
 {
     if (!typeof(ISimObject).IsAssignableFrom(t))
     {
         return(null);
     }
     return((ISimObject)SimDictionary.CreateInstance(t, this));
 }
        public T As <T>() where T : ConsoleObjectBase
        {
            if (this is ISimObject sim)
            {
                return((T)SimDictionary.CreateInstance(typeof(T), sim));
            }

            throw new NotImplementedException();
        }
        public ConsoleObjectBase As(Type t)
        {
            if (!typeof(ConsoleObjectBase).IsAssignableFrom(t))
            {
                return(null);
            }

            if (this is ISimObject sim)
            {
                return((ConsoleObjectBase)SimDictionary.CreateInstance(t, sim));
            }
            else if (this is UnknownSimObject unk)
            {
                return((ConsoleObjectBase)SimDictionary.CreateInstance(t, unk));
            }

            throw new NotImplementedException();
        }
Example #4
0
 public T As <T>() where T : class, ISimObject
 {
     return((T)SimDictionary.CreateInstance(typeof(T), this));
 }