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 -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -