嵌套为每个转换lambda

嵌套为每个转换lambda

本文介绍了嵌套为每个转换lambda的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到麻烦,多次尝试但是可以成功,

I am in trouble, tried many times but could succeed ,

foreach (var tempitem in mbsRateTempList)
            {
                foreach (var Saveditem in mbsSavedRecordList)
                {
                    if (tempitem.MbsSecurityId == Saveditem.MbsSecurityId && tempitem.CouponRate == Saveditem.CouponRate
                           && tempitem.SettlementMonth.Month == Saveditem.SettlementMonth.Month && tempitem.Price == Saveditem.Price)
                    {
                        TobeDeletedIds.Add(Saveditem.Id);
                        MatchedIdsInTempList.Add(tempitem.TempId);
                        //mbsSavedRecordList[0].ObjectState=Repository.Pattern.Base.Infrastructure.ObjectState.
                    }
                    //else
                    //{

                    //}
                }
            }





我尝试过:





What I have tried:

List

推荐答案

var query = (from x in mbsRateTempList
                         from y in mbsSavedRecordList
                          .Where(y => y.CouponRate == x.CouponRate && x.Price == y.Price
                          && x.MbsSecurityId == y.MbsSecurityId && x.SettlementMonth.Month == y.SettlementMonth.Month)
                         select new { tempId = x.tempId, Id = y.Id }).ToList();





还有其他办法吗?



Is there any other way to do this ?


这篇关于嵌套为每个转换lambda的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-10 07:04