Advertisement
Guest User

What type is it?

a guest
Dec 10th, 2014
2,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.23 KB | None | 0 0
  1.     private static void RegisterFubarConverterTypes()
  2.     {
  3.       foreach (Type type in Enumerable.Where<Type>(Enumerable.SelectMany<Assembly, Type>(Enumerable.Select<FileInfo, Assembly>(Enumerable.Select<string, FileInfo>((IEnumerable<string>) Directory.GetFiles(Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath), "Fubar.*.dll"), (Func<string, FileInfo>) (filePath => new FileInfo(filePath))), (Func<FileInfo, Assembly>) (fileInfo => AppDomain.CurrentDomain.Load(fileInfo.Name.Replace(fileInfo.Extension, string.Empty)))), (Func<Assembly, IEnumerable<Type>>) (assembly => UtilityFubar.GetAssemblyPublicTypes(assembly))), (Func<Type, bool>) (implementation => typeof (IFubarConverter).IsAssignableFrom(implementation) && implementation.IsClass && !implementation.IsAbstract)))
  4.       {
  5.         IFubarConverter converter = Activator.CreateInstance(type) as IFubarConverter;
  6.         if (type.IsSubclassOf(typeof (XmlToFubarConverter)))
  7.           UtilityFubar.RegisterFubarConverterType(UtilityFubar.XmlToFubarConverterTypes, converter);
  8.         else if (type.IsSubclassOf(typeof (FubarToXmlConverter)))
  9.           UtilityFubar.RegisterFubarConverterType(UtilityFubar.FubarToXmlConverterTypes, converter);
  10.       }
  11.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement