本帖最后由 师弟 于 2013-12-5 19:52 编辑
class Program
{
public void Print(int a, int b = 10, params int[] ints)
{
Console.WriteLine("a="+a);
Console.WriteLine("b="+b); //这里我想b输出10
foreach(int i in ints)
{
Console.WriteLine(i);
}
return;
}
static void Main(string[] args)
{
Program pr = new Program();
pr.Print(1, 2, 3); //如我想给a传1,ints传2、3,该怎么写呢?
Console.ReadKey();
}
} |