Convert a string to a character array
Hello everyone! We are back with a series of Brain Teasers. In the next 3 weeks we will publish one teaser per week.
It will run until Friday and the winner will be announced on the next Monday, taking home the eBook version of Microsoft Windows PowerShell 3.0 First Look written by Adam Driscoll. We would like to thank our sponsor Packt, one of the most prolific and fast-growing tech book publishers in the world, for providing such a cool prize.
OK, time to start your engine, here goes the first one 🙂
You have a string, “PowerShell”, you need to break it to its individual characters so the result is a collection of System.Char objects:
You cannot cast the string to char array, e.g [char]”PowerShell”
You cannot use the String.ToCharArray method
The most shortest/elegant solution wins.