LINQ与反射

string file = @"C:Windowswinsxsx86_netfx35linq-system.core_31bf3856ad364e35_6.1.7601.17514_none_6161fc35ed136622System.Core.dll";
            Assembly assembly = Assembly.LoadFrom(file);

            var pubTypeQuery = from type in assembly.GetTypes()
                               where type.IsPublic
                               from method in type.GetMethods()
                               where method.ReturnType == typeof(string)
                               group method.ToString() by type.ToString();

            foreach (var item in pubTypeQuery)
            {
                Console.WriteLine(item.Key);
                foreach (var item1 in item)
                {
                    Console.WriteLine(item1);                    
                }                
            }

            Console.WriteLine();
            Console.WriteLine("Press Any Key to Exit...");
            Console.ReadKey();
原文地址:https://www.cnblogs.com/zhengwk/p/5302582.html