Click here to Skip to main content
15,845,785 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
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)


What I have tried:

Updated 11-Oct-16 5:35am
OriginalGriff 11-Oct-16 4:11am    
I don't see any question there, just a lump of code.
It's possible that you have been the victim of a current bug: unless you encode HTML or enclose your code in pre tags anything after a less than sign will be deleted - this is in the process of being fixed but it's a recalcitrant little devil - so the "what I have tried" part is pretty empty.
Try again by using the "Improve question" widget and paste your data again. This time, use the "Encode" or "code block" options in the paste pop-up to preserve your sample.

1 solution

I am sorry, I was trying to convert in to lambda or linq but could n't able to do.
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 ?
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900