c# - Rewrite foreach statement to linq -


i still learning linq bear me :). question, how convert following code linq

int count = 0;  foreach (var item in settings.favouritessetting) {    if (item.favouritetype != constants.favouritetype.folder)       count++; }  return count.tostring(); 

var count = settings.favouritessetting.count(i => i.favouritetype != constants.favouritetype.folder);  return count.tostring(); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -