我有3个自定义对象BiometricLog
列表:
uploadedLog
,logsFromBiometric
和logsToBeUploaded
。
匹配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();