我有一个列表:var strings = new List<string>();
我的列表包含 5 个字符串。
string.Add("Paul");
string.Add("Darren");
string.Add("Joe");
string.Add("Jane");
string.Add("Sally");
我想遍历列表,只要找到以“J”开头的字符串,就不需要继续处理列表。
这可以用 LINQ 实现吗?
最佳答案
关于c# - 如何在不使用 LINQ 遍历整个列表的情况下查找 C# 列表中的第一个匹配项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14655519/