Adding new Items to List replacing old Items in List
I am using below code to loop through items and adding items to list. But While adding items to list, old items on the list are getting replaced with new items. How can I avoid items replacement in list.var finalMenuList=new List<IMenu>();
foreach(var menuSKU in iMenuSKUList)
{
var menu = new IMenuSKU();
menu=iMenuList.Where(a => a.Id == menuSKU.Id).ToList().First();
var menuSpecs=new List<IMenuMapping>() ;
menuSpecs= iMenuCompleteSKUList.Where(a => a.Id == menuSKU.Id ).ToList();
var media = new List<IMenuMedia>();
media = iMediaList.Where(a => a.Id == menuSKU.Id).ToList();
menu.MenuMappings = null;
menu.MenuMappings = menuSpecs;
menu.MenuMedias = null;
menu.MenuMedias = media;
finalMenuList.Add(menu);
}