private List<T> ParsePolicyDetails<T>(List<HouseHoldview> lsthousehold)
{
List<T> lstPolicyInfo = new List<T>();
var checkInHouseHold = from c in lsthousehold
where c.PolicyDetail.Any(p => p.LineOfBusiness.Trim().ToUpper() == "A" && p.PolicySourceSystem.ToUpper().Trim() != "PLCS"
&& p.PolicySourceSystem.ToUpper().Trim() != "APS"
&& p.PolicySourceSystem.ToUpper().Trim() != "FOREMOST")
select c.PolicyDetail;
foreach (var policies in checkInHouseHold)
{
var chek=policies.Where(p => p.LineOfBusiness.Trim().ToUpper() == "A" && p.PolicySourceSystem.ToUpper().Trim() != "PLCS"
&& p.PolicySourceSystem.ToUpper().Trim() != "APS"
&& p.PolicySourceSystem.ToUpper().Trim() != "FOREMOST" && p.LineOfBusiness.ToUpper().Trim() == "A");
lstPolicyInfo.Add(chek);
}
return lstPolicyInfo;
}
看起来很简单的代码,但给出了错误。由于 chek 不是类型 T 如何处理这个
错误是 'System.Collections.Generic.List.Add() 的最佳重载方法匹配