小编sup*_*lub的帖子

c#:找不到列表中的对象

我正在使用LINQ .Find(),当它找到匹配时它不会停止.我有:

List<ipFound> ipList = new List<ipFound>();

ipFound ipTemp = ipList.Find(x => x.ipAddress == srcIP); 

if (ipTemp == null) {
   // this is always null
}

public class ipFound
{
    public System.Net.IPAddress ipAddress;
    public int bytesSent;
    public int bytesReceived;
    public int bytesTotal;
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我在这里疯了.

谢谢!

c# list

7
推荐指数
2
解决办法
235
查看次数

标签 统计

c# ×1

list ×1