using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;namespace ConsoleApplication1
{public delegate double Calc(double x, double y); //定義委托class MyClass{public void ListInts(int a, params int[] inVals){Console.WriteLine("input number is {0}", a);if ((inVals != null) && (inVals.Length != 0)){for (int i = 0; i < inVals.Length; i++){inVals[i] = inVals[i] * 10;Console.WriteLine("{0}", inVals[i]);}}}}class Program{static void Main(string[] args){//參數(shù)數(shù)組:傳入值類型并不會并改變//int first = 5, second = 6, third = 7;//MyClass mc = new MyClass();//mc.ListInts(first, second, third);//Console.WriteLine("{0} {1} {2}", first, second, third);//參數(shù)數(shù)組:傳入引用烈性會被改變int[] arr = new int[] { 5, 6, 7};MyClass mc = new MyClass();mc.ListInts(3, arr);foreach (var item in arr){Console.WriteLine(item);}}}
}