Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static IEnumerable<T> Where<T>(this IEnumerable<T> source, Func<T, bool> predicate)
- {
- if (source == null) throw new ArgumentNullException(nameof(source));
- if (predicate == null) throw new ArgumentNullException(nameof(predicate));
- return Iterator();
- IEnumerable<T> Iterator()
- {
- foreach (T item in source)
- {
- if (predicate(item))
- {
- yield return item;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement