Guest User

Untitled

a guest
Jan 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. void Main()
  2. {
  3. // Write code to test your extensions here. Press F5 to compile and run.
  4. }
  5.  
  6. public static class MyExtensions
  7. {
  8. // Write custom extension methods here. They will be available to all queries.
  9. public static IEnumerable<T> ForEach<T>(this IEnumerable<T> source, Action<T> consumer)
  10. {
  11. throw new Exception(consumer.ToString());
  12. foreach (var each in source)
  13. {
  14. consumer(each);
  15. yield return each;
  16. }
  17. }
  18. }
  19.  
  20. // You can also define non-static classes, enums, etc.
Add Comment
Please, Sign In to add comment