Csharp/C Sharp by API/System.Reflection/Module

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Module.FullName

<source lang="csharp"> using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Reflection; using System.Reflection.Emit; public class MainClass {

   public static void Main()
   {
       Assembly a = Assembly.GetExecutingAssembly();
       Module m = a.ManifestModule;
       PortableExecutableKinds peKinds;
       ImageFileMachine imageFileMachine;
       m.GetPEKind(out peKinds, out imageFileMachine);
       Console.WriteLine("{0}: {1}...{2}", a.FullName, peKinds, imageFileMachine);
       if ((peKinds & PortableExecutableKinds.ILOnly) != 0)
       {
           Console.WriteLine("platform independent");
       }
       else
       {
           Console.WriteLine("platform dependent");
           switch (imageFileMachine)
           {
               case ImageFileMachine.I386:
                   Console.WriteLine("I386");
                   break;
               case ImageFileMachine.IA64:
                   Console.WriteLine("IA64");
                   break;
               case ImageFileMachine.AMD64:
                   Console.WriteLine("AMD64");
                   break;
           }
       } 
   }

}


 </source>