嵌套为每个转换lambda [英] Nested for each to convert lambda

查看:114
本文介绍了嵌套为每个转换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

推荐答案

对不起,我试图转换为lambda或linq但无法做到。

FYI:

我是通过



I am sorry, I was trying to convert in to lambda or linq but could n't able to do.
FYI:
I did it by

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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆