示例#1
0
        /// <summary>
        /// Get each and every configured instance that could possibly
        /// be cast to T
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public IEnumerable <T> GetAllPossible <T>() where T : class
        {
            var targetType = typeof(T);

            return(AllInstances
                   .Where(x => x.ReturnedType.CanBeCastTo(targetType))
                   .Select(x => x.Get <T>())
                   .Where(x => x != null));
        }
示例#2
0
        public void ReadInstanceResults(BinaryReader reader)
        {
            int len = reader.ReadInt32();

            for (int i = 0; i < len; i++)
            {
                uint instID = reader.ReadUInt32();
                bool exists = reader.ReadInt32() != 0;
                if (exists)
                {
                    var __inst = AllInstances.Where(inst => inst.ID == instID).First();
                    __inst.Deserialize(reader, this);
                }
                else
                {
                    Console.WriteLine("No instance exists for ID " + instID.ToString());
                }
            }
        }
示例#3
0
 public Dictionary <CodeBag, IEnumerable <Instance> > ByNamespace()
 {
     return(Graph.AllNamespaces.ToDictionary(ns => ns, ns => AllInstances.Where(x => x.CodeBag.Equals(ns))));
 }