在我用 C# 编写的以下程序中:
static void Main(string[] args)
{
paramsAndOptionalTest(1,2);
#pragma region CmdLineStuff
for (int i = 0; i < args.Length; i++)
{
Console.WriteLine("{0}", args[i]);
}
foreach (string arg in args)
{
Console.WriteLine(arg);
}
string[] apiargs = Environment.GetCommandLineArgs();//this will give the executable name and path too
int exitCode = Environment.ExitCode;
foreach (string arg in apiargs)
{
Console.WriteLine(arg);
}
Console.WriteLine("Exit Code {0}", exitCode);
string myString = string.Format("11 in hexa is {0:x}", 11);
System.Windows.MessageBox.Show(myString);
#pragma endregion CmdLineStuff
ImmutableStrings();
Console.ReadLine();
}
我使用了#pragma region。但是我收到 CS1633: Unrecognized #pragma directive 警告。所以我认为 C# 编译器无法识别这个 Pragma,而在 C++ 中它工作得很好。C# 中是否有这个 pragma 的等价物?