Call by Reference (param, ref, out)
Call by Reference (params, ref, out) params params 키워드를 사용하면 가변 개수의 인수를 사용하는 메소드 매개 변수를 지정할 수 있다. 그리고 인수를 보내지 않아도 된다. 인수를 보내지 않는 경우 params의 길이가 0이다.using System; namespace Petzold { class Program { static void Main(string[] args) { int[] arr = { 22, 33, 55, 100, 10, 2 }; //222 Console.WriteLine(AddUpArray(arr)); //222 Console.WriteLine(AddUpArray(22, 33, 55, 100, 10, 2)); //0 Console.WriteLine(A..
더보기