本文整理汇总了C#中System.Reflection.PortableExecutable.PEHeaders.RequiresAmdInstructionSet方法的典型用法代码示例。如果您正苦于以下问题:C# PEHeaders.RequiresAmdInstructionSet方法的具体用法?C# PEHeaders.RequiresAmdInstructionSet怎么用?C# PEHeaders.RequiresAmdInstructionSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.PortableExecutable.PEHeaders
的用法示例。
在下文中一共展示了PEHeaders.RequiresAmdInstructionSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckCorflags
public void CheckCorflags()
{
string source = @"
class C
{
public static void Main()
{
}
}";
PEHeaders peHeaders;
var compilation = CreateCompilationWithMscorlib(source, compOptions: TestOptions.Exe.WithPlatform(Platform.AnyCpu));
peHeaders = new PEHeaders(compilation.EmitToStream());
Assert.Equal(CorFlags.ILOnly, peHeaders.CorHeader.Flags);
compilation = CreateCompilationWithMscorlib(source, compOptions: TestOptions.Exe.WithPlatform(Platform.X86));
peHeaders = new PEHeaders(compilation.EmitToStream());
Assert.Equal(CorFlags.ILOnly | CorFlags.Requires32Bit, peHeaders.CorHeader.Flags);
compilation = CreateCompilationWithMscorlib(source, compOptions: TestOptions.Exe.WithPlatform(Platform.X64));
peHeaders = new PEHeaders(compilation.EmitToStream());
Assert.Equal(CorFlags.ILOnly, peHeaders.CorHeader.Flags);
Assert.True(peHeaders.Requires64Bits());
Assert.True(peHeaders.RequiresAmdInstructionSet());
compilation = CreateCompilationWithMscorlib(source, compOptions: TestOptions.Exe.WithPlatform(Platform.AnyCpu32BitPreferred));
peHeaders = new PEHeaders(compilation.EmitToStream());
Assert.False(peHeaders.Requires64Bits());
Assert.False(peHeaders.RequiresAmdInstructionSet());
Assert.Equal(CorFlags.ILOnly | CorFlags.Requires32Bit | CorFlags.Prefers32Bit, peHeaders.CorHeader.Flags);
compilation = CreateCompilationWithMscorlib(source, compOptions: TestOptions.Exe.WithPlatform(Platform.Arm));
peHeaders = new PEHeaders(compilation.EmitToStream());
Assert.False(peHeaders.Requires64Bits());
Assert.False(peHeaders.RequiresAmdInstructionSet());
Assert.Equal(CorFlags.ILOnly, peHeaders.CorHeader.Flags);
}