Exact duplicate: http://stackoverflow.com/questions/18465/net-parse-verses-convert can anyone help me?
+1
A:
The parse method gives you more options for numeric formats. Other than that, they're virtually identical.
MSDN says:
Steven Richards
2009-05-02 09:24:06
+2
A:
Convert.ToInt32(string)
and Int32.Parse(string)
yield identical 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 it is better to use Int32.Parse(string)
DaDa
2009-05-02 09:26:53
Which one is better actually depends on your needs.
Joey
2009-05-02 09:48:33
thank you DaDa!
2009-05-02 10:28:10
+1
A:
Int.Parse() try to parse can also accept format
Int.Parse(String, NumberStyles)
you can also specify out parameter and parse will just return true or false to show whether parsing was successful or not
Adinochestva
2009-05-02 09:29:38