Extension Method to Reverse an integer in c#
June 26, 2011 Leave a comment
Was interviewing a campus student for our team, with one of my colleague. We asked her to write a code snippet, to reverse an integer.
The only programming language that she knew was C. She wrote a program in C, which had almost 20-25 lines of code. It wasn’t too neat, but was pretty good for a campus student.
After the interview, I was wondering, how should a guy working with C# for around 5years answer it.
And thought this could be good way to write it.
There are much better ways, this one uses Extension Methods, Lamda Expressions, to solve a simple problem.
I feel the best way to learn a language, is to make simple things complex, just like above ;).