선생님 안녕하세요!
using System;
using System.Collections.Generic;
public class Hello1
{
public static void Main()
{
int[] array = { 10, 20, 30, 40, 50, 60, 70, 80, 90 };
List<ArraySegment<int>> list = new List<ArraySegment<int>>();
ArraySegment<int> segment1 = new ArraySegment<int>(array, 0, 2); // 10, 20
ArraySegment<int> segment2 = new ArraySegment<int>(array, 4, 3); // 50, 60, 70
list.Add(segment1);
list.Add(segment2);
for(int i = 0; i < list.Count; i++)
Console.WriteLine(list[i]);
}
}
[출력]
System.ArraySegment`1[System.Int32]
System.ArraySegment`1[System.Int32]
[질문 1]
저는 Array에 있는 것을 일부 떼어서 ArraySegment에 각각 옮긴 후,
이것을 list에 추가하려고 합니다.
예상 출력값을 10, 20, 50, 60, 70으로 생각했지만
알 수 없는 출력값이 보입니다...
어떻게 하면 되는지 도움 부탁드립니다!
[최초 등록일: ]
[최종 수정일: 12/23/2020]