どうも、ちょげ(@chogetarou)です。
リスト(List)の長さを取得する方法を紹介します。
方法

リスト(List)の長さを取得するには、Countプロパティを使います。
具体的には、「list.Count」のように、リスト(List)のCountプロパティにアクセスします。
int length = list.Count;
Countプロパティは、リスト(List)の長さを返します。
使用例
using System;
using System.Collections.Generic;
public class Example
{
public static void Main()
{
List<string> myList = new List<string>() { "a", "b", "c", "d", "e"};
int length = myList.Count;
Console.WriteLine(length); //5
}
}
コメント