Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Main()
- {
- // Write code to test your extensions here. Press F5 to compile and run.
- }
- public static class MyExtensions
- {
- // Write custom extension methods here. They will be available to all queries.
- public static IEnumerable<T> ForEach<T>(this IEnumerable<T> source, Action<T> consumer)
- {
- throw new Exception(consumer.ToString());
- foreach (var each in source)
- {
- consumer(each);
- yield return each;
- }
- }
- }
- // You can also define non-static classes, enums, etc.
Add Comment
Please, Sign In to add comment