C# 生成一个30长度的int类型的数组,求有多少奇数偶数,用REF传递参数来求出奇数偶数

要求使用return语句可以从方法中返回一个数值,调用方法可以勇赋值运算符获得被调
用方法的返回值。
使用按引用传递方式可以从方法中返回多于一个的数值,调用方法和被调用方法的参数之前都必须勇REF关键字进行修饰

void foo(int[] arr, ref in odd, ref int even)
{
even = arr.Where(x => x % 2 == 0).Count();
odd = arr.Where(x => x % 2 == 1).Count();
}
调用
int a = {1,2,3,4,5,... 30};
int even = 0;
int odd = 0;
foo(a, ref odd, ref even);
Console.WriteLine("偶数有{0},奇数有{1}", even, odd);