1
0
mirror of https://github.com/rudollee/LearningMVC.git synced 2026-08-12 00:42:57 +00:00
This commit is contained in:
wook
2017-04-03 02:31:15 +09:00
parent 69a9bc7a86
commit 9849d5f18d
3 changed files with 50 additions and 1 deletions
@@ -16,5 +16,27 @@ namespace LanguageFeatures.Models
}
return total;
}
public static IEnumerable<Product> FilterByCategory(this IEnumerable<Product> productEnum, string categoryParam)
{
foreach (Product prod in productEnum)
{
if (prod.Category == categoryParam)
{
yield return prod;
}
}
}
public static IEnumerable<Product> Filter(this IEnumerable<Product> productEnum, Func<Product, bool> selectorParm)
{
foreach (Product prod in productEnum)
{
if (selectorParm(prod))
{
yield return prod;
}
}
}
}
}