C# 在linq查询中使用函数时获取函数求值Timedout错误
提前谢谢 我正在尝试查询一个对象并根据结果创建匿名类型。我正在linq查询中使用一个函数。在这个阶段,我得到一个错误,说函数评估已禁用,因为以前的函数评估超时。您必须继续执行才能重新启用函数 请在下面找到我的示例代码C# 在linq查询中使用函数时获取函数求值Timedout错误,c#,linq,C#,Linq,提前谢谢 我正在尝试查询一个对象并根据结果创建匿名类型。我正在linq查询中使用一个函数。在这个阶段,我得到一个错误,说函数评估已禁用,因为以前的函数评估超时。您必须继续执行才能重新启用函数 请在下面找到我的示例代码 var serviceResult = _service.GeResponse(panId, numberOfTransactions, startDate, endDate); var balanceTrans = GetAllTypes<BalanceAdjustmen
var serviceResult = _service.GeResponse(panId, numberOfTransactions, startDate, endDate);
var balanceTrans = GetAllTypes<BalanceAdjustment>(serviceResult);
var presentmentTrans = GetAllTypes<Presentment>(serviceResult);
var test = balanceTrans.AsEnumerable();
var obj = test.Select(item => new SearchCardTransactionResult
{
PanId = item.PanId,
CardNumber = item.CardNumberFormatted,
Balance = item.FinancialBalance,
BillingAmount = Math.Abs(item.BillingAmount).Format(),
BillingCurrency = GetCurrencyCode(item.BillingCurrency)
});
private IList<T> GetAllTypes<T>(GetTransactionsResponse result)
where T : ValitorServices.ValitorPanWS.AbstractFinancialTransaction
{
return result.FinanacialTransactions.OfType<T>().ToList();
}
谁能告诉我我做错了什么
非常感谢我使用以下代码设法解决了这个问题
var currencyCodes = _service.GetCurrencyCodes().ToList();
var test = balanceTrans.AsEnumerable();
var obj = test.AsEnumerable().Select(item => new SearchCardTransactionResult
{
PanId = item.PanId,
CardNumber = item.CardNumberFormatted,
Balance = item.FinancialBalance,
BillingAmount = Math.Abs(item.BillingAmount).Format(),
BillingCurrency = currencyCodes.First(c=>c.NumericCode.Equals(item.BillingCurrency)).AlphabeticCode
});