应用程序集

//  System.Reflection.Assembly[]assemblys=AppDomain.CurrentDomain.GetAssemblies();
            //foreach (var item in assemblys)
            //{
            //    Console.Write(item.GetName());
            //}
           // Console.WriteLine("**********应用程序集************");
           // //Assembly assembly=Assembly.Load("XXX.dll")//加载应用程序集
           // Assembly asm = Assembly.GetExecutingAssembly();
           // Console.WriteLine("当前程序集的根目录" + asm.CodeBase);//E:\silkworm\ReflectionExam\bin\Debug\ReflectionExam.exe
           // Console.WriteLine("当前程序集的入口点" + asm.EntryPoint);//void Main(string[]args);

           // AssemblyName asmName=asm.GetName();//这与asm.FullName功能一样
           // Console.WriteLine("获取程序集的显示名称:" + asmName.Name);//ReflectionExam
           // Console.WriteLine("获取程序集的版本名称:"+asmName.Version);//1.0.0.0

           // Console.WriteLine("**********Type类型************");
           // Type tPepper = Type.GetType("ReflectionExam.Pepper");
           // Console.WriteLine("类型所在的命名空间:"+tPepper.Namespace.ToString());
           // Console.WriteLine("获取方法的基本信息" + tPepper.GetMember("PrintDatas"));
           // Console.WriteLine("获取属性的基本信息" + tPepper.GetProperty("Name"));

             //在调试模式下:

            Console.Write(System.Reflection.Assembly.GetExecutingAssembly().Location.ToString())//输出C:\Users\ganquanfu\Desktop\bin\ConTest.exe;
            Console.Write(System.Diagnostics.Process.GetCurrentProcess().ProcessName);//输出ConTest.vshost;
            Console.Write(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);//输出C:\Users\ganquanfu\Desktop\bin\ConTest.vshost.exe

 

 

 

posted @ 2013-03-28 18:56  Predator  阅读(146)  评论(0编辑  收藏  举报