Generic List
예를 들어 보겠습니다 -
목록을 먼저 설정했습니다 -
List<string> myList = new List<string>()
이제 목록에 요소를 추가하십시오 -
List<string> myList = new List<string>() {
"mammals",
"reptiles",
"amphibians"
} 이제 속성을 사용하여 추가된 요소 수를 계산해 보겠습니다. -
예시
using System;
using System.Collections.Generic;
class Program {
static void Main() {
List<string> myList = new List() {
"mammals",
"reptiles",
"amphibians"
};
Console.WriteLine(myList.Count);
}
}