/// <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)); }
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()); } } }
public Dictionary <CodeBag, IEnumerable <Instance> > ByNamespace() { return(Graph.AllNamespaces.ToDictionary(ns => ns, ns => AllInstances.Where(x => x.CodeBag.Equals(ns)))); }