在尝试使用一组DB对象时,我收到错误。
using (var context = new Entities())
{
var allRates = context.CurrencyRate;
var rates = new List<CurrencyRate>();
//get rates for selected currency types
foreach (var newRate in newCurrencyRateList)
{
rates.AddRange(allRates.Where(r => r.CurrencyTypeId == newRate.CurrencyId).OrderByDescending(r => r.CreatedDate).ToList().Take(4));
}
//Delete old rates
var oldRates = allRates.Except(rates);
if (oldRates != null && oldRates.Any())
{
....
}
}
实体() - 数据模型。
我在
上遇到错误oldRates.Any()
如何解决?