namespace 传递任意参数
{
class Program
{
static void Main(string[] args)
{
//可传递任意数量参数
Test(1, 2, "sasda");
}

static void Test(params object[] arguments)
{
Console.WriteLine(arguments.Length);
foreach (var item in arguments)
{
Console.WriteLine(item);
}
}
}
}

相关文章:

  • 2021-12-21
  • 2021-07-25
  • 2021-12-02
  • 2021-06-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-31
  • 2022-12-23
  • 2021-08-23
  • 2021-05-22
  • 2021-08-24
  • 2022-12-23
相关资源
相似解决方案