Hello, when the loop below runs, I need to add elements continuously.
I tried to do something like this but it didn't work. How can I solve this problem.
then i want to pull the data collected in the list.
oreach (var item in products) { List<Urunler> list = new List<Urunler>(); list.Add(from p in models select new { label = p.Name, producturl = Url.RouteUrl("Product", new { SeName = p.SeName }), productpictureurl = p.DefaultPictureModel.ImageUrl }; result = models.Where(x => x.Id == item.Id).Select(p => new { label = p.Name, producturl = Url.RouteUrl("Product", new { SeName = p.SeName }), productpictureurl = p.DefaultPictureModel.ImageUrl }).ToList(); }
public class Urunler { public string Pname { get; set; } public string Url { get; set; } public string Photo { get; set; } }