Created
October 11, 2013 20:12
-
-
Save dazfuller/6941266 to your computer and use it in GitHub Desktop.
Reversing a string by creating an extension method on a character array
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() | |
| { | |
| var newString = "Ignoring the Voices".Reverse().ToArray().AsString(); | |
| newString.Dump(); | |
| } | |
| // Define other methods and classes here | |
| public static class EnumerableExtensions | |
| { | |
| public static string AsString(this char[] array) | |
| { | |
| return new string(array); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment