List<String> hello = new List<String>();
hello.Add("red");
hello.Add("blue");
インデックスを使用してこのリストを検索して、どれが になるかを取得"red"
するにはどうすればよい0
ですか? いろいろな方法を試しましたが、だめでした。
あなたの質問を理解できれば、.FindIndex Method
List<String> hello = new List<String>();
hello.Add("red");
hello.Add("blue");
var index = hello.FindIndex(c => c == "red");
var word = hello[index]; //<-- get the word
そして最後に使用.ElementAt Method
var word = hello.ElementAt(0);