Test(5,6,7,8,9,10);
                       
            void Test(int sd, params int[] arr)//不定长参数前要加params
            {
                for(int i = 0 ; i < arr.Length; i++)
                {
                    Console.WriteLine(i+"---"+arr[i]);
                }
            }


Result:

C#不定长参数

相关文章:

  • 2022-12-23
  • 2021-05-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2022-01-02
  • 2021-06-24
  • 2020-10-16
  • 2021-11-24
  • 2021-12-29
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案