Thursday, March 06, 2008 11:55 AM mikedopp

Reverse a String .NET

How to reverse a string demo. *you need to know this if you want a job at Microsoft.

public string someMethod(string, input)

{

char[] chars = input.ToCharArray();

Array.Reverse(chars);

return new string(chars);

}

Go ahead and cheat. its ok.

Filed under: ,

Comments

# re: Reverse a String .NET

Thursday, March 06, 2008 2:51 PM by Mladen

this is another way :)

weblogs.sqlteam.com/.../9350.aspx

# re: Reverse a String .NET

Thursday, March 06, 2008 3:06 PM by mcp111

mladen - your code is much more complicated :-)

# re: Reverse a String .NET

Thursday, March 06, 2008 6:18 PM by bungle

# re: Reverse a String .NET

Friday, March 07, 2008 5:46 AM by Mladen

oh i know... but it's fun!

isn't that the whole point :)

and interestingly enough you'd be amazed at how many CS graduates and senior developers have no idea what that code does if you show it to them without the comments.

Leave a Comment

(required) 
(required) 
(optional)
(required)