Guest User

Untitled

a guest
May 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 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> Prepend<T>(this IEnumerable<T> sequence, T element) =>
  10. new[] { element }.Concat(sequence);
  11.  
  12. public static string Stringify<T>(this IEnumerable<T> sequence)
  13. {
  14. if (sequence.Count() == 0)
  15. {
  16. return "Empty";
  17. }
  18.  
  19. return string.Join(",", sequence);
  20. }
  21.  
  22. public static T DumpWithCurrentMethodName<T>(this T o, [CallerMemberName] string callerName = "")
  23. {
  24. return o.Dump(callerName);
  25. }
  26. }
  27.  
  28.  
  29.  
  30. // You can also define non-static classes, enums, etc.
Add Comment
Please, Sign In to add comment