public static SortedDictionary <Guid, Type> LoadTypeMap(Func <string, bool> filter = null) { var collector = new SortedDictionary <Guid, Type>(); var qAssemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (var assem in qAssemblies) { var qTypes = assem.GetTypes().ToList(); foreach (var t in qTypes) { if (filter != null && !filter(t.FullName)) { continue; } var fullname = t.FullName; //Console.WriteLine(fullname); var guid_attrs = t.GetCustomAttributes(typeof(GuidAttribute), false); var guid = CtkUtil.TypeGuid(t); if (guid == null) { continue; } if (collector.ContainsKey(guid.Value)) { //var t2 = collector[guid.Value]; //throw new Exception(string.Format("Type {0} and {1} have same Guid", t.FullName, t2.FullName)); } collector[guid.Value] = t; } } return(collector); }