为什么当我运行此控制台应用程序时:
static void Main(string[] args)
{
var items = new List<(string login, string email)>();
items.Add(("james", "lsdkjsdkj@skdfjd.dfkd"));
items.Add(("james2", "lsdkjsdkj@df333.dfkd"));
items.Add(("james", "lsdkjsdkj@skdfjd.dfkd"));
items.Add(("james2", "lsdkjsdkj@df333.dfkd"));
foreach (var item in items)
{
Console.WriteLine(item.email);
}
var duplicates = items.Where(e => e.login == "james");
Console.WriteLine(duplicates.Count());
foreach (var duplicate in duplicates)
{
Console.WriteLine($"Found: {duplicate.login}, {duplicate.email}");
}
Console.ReadLine();
}
它正确显示了变量duplicates
的内容:
但是当我调试时,它没有显示duplicates
的内容:
答案 0 :(得分:2)