I saw an interview question.
Write a function to reverse a string.
It’s a simple question, Hmm? But not so simple.
In Java, StringBuilder class provided a convenient method to reverse the characters it holds, and in C#, we have a static method Array.reverse() to help us. Also, we can write it by ourselves(it’s not a big deal, right?).
OK, let’s take a look at how we can do this.
It’s simple. Hmm? We turn the string into char array, and swap the array element. It’s done.
If we use the API provided by .NET Framework, it will be much more simple.





