【发布时间】:2009-11-14 20:09:06
【问题描述】:
我需要写一些东西来获取启动参数,然后为这些启动参数做一些事情,我认为 switch 会很好,但它只接受整数,它必须是字符串
这不是实际的代码,但我想知道如何使这样的东西工作
namespace Simtho
{
class Program
{
static void Main(string[] args)
{
switch (Environment.GetCommandLineArgs())
{
case "-i":
Console.WriteLine("Command Executed Successfully");
Console.Read;
break;
}
}
}
}
【问题讨论】:
-
你可以打开字符串就好了。
标签: c# string switch-statement