第一个参数为数值
第二个参数为字符串新手

解决方案 »

  1.   

            static void Main(string[] args)
            {
                
            }
    在 args 数组里面
      

  2.   

    我是这样做的:
    static void Main(string[] args)
            {
            
                
             string arg = "";
                int shu = 0;
                for (int i=0; i < args.Length; i++)
                {
                   switch (i)
                   { 
                       case 0:
                           shu = Convert.ToInt32(args[i]);
                           break;
                       case 1:
                            arg = args[i];
                           break;
                    }
               }
               Console.WriteLine("{0}", shu);
               Console.WriteLine("{0}", arg);
               Console.ReadKey();
            }感觉走了很多弯路,哪位高手能帮忙优化一下吗?
    谢谢
      

  3.   

    要求已经明确了参数个数、类型和顺序,就不要做无谓多余的事...
    static void Main(string[] args)
    {
        double d;
        if (args.Length != 2 || !double.TryParse(args[0], out d))
        {
            Console.Write("Usage:");
            Console.Write(System.Diagnostics.Process.GetCurrentProcess().ProcessName);
            Console.WriteLine(" number string");
            return;
        }
        string s = args[1];
        //todo...
    }