リストを作成していて、リストに追加されたアイテムの値を設定してから、その値を取得して表示したいと思います。
// Create a list of strings
List<string> AuthorList = new List<string>();
AuthorList.Add("AA");
AuthorList.Add("BB");
AuthorList.Add("CC");
AuthorList.Add("DD");
AuthorList.Add("EE");
// Set Item value
AuthorList["AA"] = 20;
// Get Item value
Int16 age = Convert.ToInt16(AuthorList["AA"]);
// Get first item of a List
string auth = AuthorList[0];
Console.WriteLine(auth);
// Set first item of a List
AuthorList[0] = "New Author";
しかし、エラーが発生しました
「「System.Collections.Generic.List.this[int]」に最適なオーバーロードされたメソッドの一致には、いくつかの無効な引数があります」
このコードを修正するのを手伝ってください。