标签:
class Program { static void Main(string[] args) { //常规使用方法 Console.WriteLine(Add(new Int32[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 })); //另一种调用方法 Console.WriteLine(Add(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); Console.ReadKey(); } public static int Add(params Int32[] values) { int sum = 0; foreach (int item in values) { sum += item; } return sum; } }
标签:
原文地址:http://www.cnblogs.com/imhaiyang/p/4977354.html