[ C#. 배열 ]
1. 배열정의
. 레퍼런스 타입이기 때문에 참조 값만 전달
2. 선언-1차원
. int[] scores = { 1,2,3,};
. int sum = CalculateSum(scores); //배열전달: 배열명을 return함.
. double []array;
array = new double[3];
. double []array = new double[3]{1.0, 2.0, 3.0};
. double []array = {1.0, 2.0, 3.0};
2. 선언-다차원
. double [,] array2 = new double[2,3] {{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}};
. double [,,] array3 = new double[2,3,4];
3. 다차원배열 접근
. double value = array2[1,2] + array3[1,2,3];
4. 배열 속성과 메소드
. Length, Sort, GetLength, IndexOf
5. 객체 배열
. 선언 : Student [] std = new Student[3];
. 배열 객체생성 : std[0] = Stdudent();
. 배열 객체메소드 : std[0].setScore(10, 20, 30);