Tuesday, August 11, 2009

What is the difference between Convert.ToInt32() and Int32.Parse()

Convert.ToInt32(string); and Int32.Parse(string); produce the same results except when the string is actually a null.

In this case, Int32.Parse(null) throws an ArgumentNullException, but Convert.ToInt32(null) returns a zero.

So which one is better to use?

Waiting for your comments...

Hire Me

Follow me on Facebook

Follow me

Do you find this Blog helpful?

Follow by Email

About Me

My Photo
Expert Senior Software Developer

Microsoft Business Card