Extension Method to Reverse an integer in c#

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 ;).


About jacob aloysious
I'm a 26 yrs old developer working with Atmel R&D India Pvt. Ltd., Chennai. I'm currently working in C#, have done a bit of Java programming too. And also an Android enthusiast. Like spending my spare time @ SO : http://stackoverflow.com/users/1218809/jacob-aloysious

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: