-2
我有一个列表List<string> strList
字符串被添加到列表中的整个程序。查找列表中的字符串位置C#
我希望能够找到包含某个字符串的列表的某个位置或索引。
我已经成功地检查是否包含某个特定的文本字符串存在使用此代码:
if (strList.Exists(str => str.Contains("Chicken")))
{
Console.WriteLine("Found it");
}
但我想找到这个字符串的列表,它的位置。
[如何在单个步骤中获取列表中项目的索引?](http://stackoverflow.com/questions/17995706/how-to-get-the-index-of-an -Item-IN-A-列表功能于一个单步) –