Friday, June 4, 2010

What's the difference between Convert.ToInt32(string) and Int32.Parse(string)?

The two give identical results, except where the string is null. Convert.ToInt32(null) returns zero, whereas Int32.Parse(null) throws anArgumentNullException.

hat tip: http://www.yoda.arachsys.com/csharp/faq/#convert.parse

No comments:

Post a Comment