linq - joining the items in a list over foreach loop -



linq - joining the items in a list over foreach loop -

i want bring together list same list on foreach loop , generate finish list. have tried using x = x.concat(x); , x = x.addrange(x); havent worked out. please tell me doing wrong or there easier way this

try { var dc = new onyxdbentities(); int list2 = 0; int list3 = 0; var count = dc.users.select(i => i.id); //var y = (from users in dc.users users.id == 2 select new { username = users.username, fullname = users.firstname + " " + users.lastname, userid = users.id, beadsetsa = users.beadsets, designaa = users.designs }).tolist(); var y = (from users in dc.users select new { username = users.username, fullname = users.firstname + " " + users.lastname, userid = users.id, beadsetsa = list2, designaa = list3 }).tolist(); var x = y; foreach (var in count) { list2 = (from users in dc.beadsets users.userid == select users).count(); list3 = (from users in dc.designs users.userid == select users).count(); x = (from users in dc.users users.id == select new { username = users.username, fullname = users.firstname + " " + users.lastname, userid = users.id, beadsetsa = list2, designaa = list3 }).tolist(); x = x.concat(x); } createexcelfile.createexceldocument(x, "c:\\customers1.xlsx"); } grab (exception ex) { }

i getting error

cannot implicitly convert type 'system.collections.generic.ienumerable<anonymoustype#1>' 'system.collections.generic.list<anonymoustype#1>'

linq list

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -