c#入门经典第五版2010第6章练习6.8第二小题
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch06Ex6_8_2
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 2)
{
Console.WriteLine("Two arguments required");
return;
}
string param1 = args[0];
int param2 = Convert.ToInt32(args[1]);
Console.WriteLine("{0}", param1);
Console.WriteLine("{0}", param2);
}
}
}
调试的时候总是一闪而过,也不能输入数据,请高手解答下,Console.ReadKey()加在最后也不起作用
------解决方案--------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ch06Ex6_8_2
{
class Program
{
static void Main(string[] args)
{
args = new string[] { "1", "2" };
if (args.Length != 2)
{
Console.WriteLine("Two arguments required");
return;
}
string param1 = args[0];
int param2 = Convert.ToInt32(args[1]);
Console.WriteLine("{0}", param1);
Console.WriteLine("{0}", param2);
Console.ReadKey();
}
}
}