Jumat, 09 November 2007

PE and Platform Kinds

Assembly a = Assembly.GetExecutingAssembly();
Module m = a.ManifestModule;
PortableExecutableKinds peKinds;
ImageFileMachine imageFileMachine; m.GetPEKind(out peKinds, out imageFileMachine);
if ((peKinds & PortableExecutableKinds.ILOnly) != 0)
{
// Assembly is platform independent.
}
else
{
// assembly is platform dependent
switch (imageFileMachine)
{
case ImageFileMachine.I386:
// i386, x86, IA-32, ... dependent.
break;
case ImageFileMachine.IA64:
// IA-64 dependent.
break;
case ImageFileMachine.AMD64:
// AMD-64, x64 dependent.
break;
}

}

Tidak ada komentar: