Created
May 18, 2018 04:27
-
-
Save ivanxpetrov/60d62124d5c5cb3d1e8a6de3cbb60555 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> Prepend<T>(this IEnumerable<T> sequence, T element) => | |
| new[] { element }.Concat(sequence); | |
| public static string Stringify<T>(this IEnumerable<T> sequence) | |
| { | |
| if (sequence.Count() == 0) | |
| { | |
| return "Empty"; | |
| } | |
| return string.Join(",", sequence); | |
| } | |
| public static T DumpWithCurrentMethodName<T>(this T o, [CallerMemberName] string callerName = "") | |
| { | |
| return o.Dump(callerName); | |
| } | |
| } | |
| // You can also define non-static classes, enums, etc. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment