C#.NET除了linq不工作

时间:2015-12-02 10:28:34

标签: c# linq

我有3个自定义对象BiometricLog列表: uploadedLoglogsFromBiometriclogsToBeUploaded

匹配uploadedLog的所有数据都应从logsFromBiometric中移除,然后存储到logsToBeUploaded

我尝试使用此代码: logsToBeUploaded = logsFromBiometric.Except(uploadedLogs).ToList()但它不起作用。我错过了什么或做错了什么?

这是我的完整代码块。

var uploadedLogs = GetUploadedLogs();
var logsFromBiometric = new List<BiometricLog>();
var logsToBeUploaded = new List<BiometricLog>();

int counter = 0;
foreach (XmlNode biometric in biometricElements)
{
    taskArray[counter] = Task<List<BiometricLog>>.Factory.StartNew(() => ConnectAndProcessBiometric(biometric));
    counter++;
}

Task.WaitAll(taskArray);

foreach (var taskitem in taskArray)
{
    logsFromBiometric.AddRange(taskitem.Result);
}

logsFromBiometric.RemoveAll(m => uploadedLogs.Contains(m));

logsToBeUploaded = logsFromBiometric.Except(uploadedLogs).ToList();

0 个答案:

没有答案