첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ String 클래스의 Split 정적 메소드를 사용해 CSV 문자열을 List<T> 타입으로 변환하는 방법을 보여준다.

 

▶ 예제 코드 (C#)

string sourceList = "1,2,3,4,5";

List<int> targetList = new List<int>(sourceList.Split(',').Select(source => int.Parse(source)));

foreach(int target in targetList)
{
    Console.WriteLine(target);
}
728x90
그리드형(광고전용)
Posted by icodebroker
,