我还在学习LINQ
,所以请耐心等待:)。我的问题,如何将以下代码转换为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();
var count = (from item in settings.FavouritesSetting
where item.FavouriteType != Constants.FavouriteType.Folder
select item).Count();
return count.ToString();