Difference between int.Parse and int.TryParse [Resolved]

Posted by Patel28rajendra under ASP.NET on 3/28/2012 | Points: 10 | Views : 4682 | Status : [Member] | Replies : 3
Hi

What is the Difference between int.Parse and int.TryParse
please give example

Thanks

R D Patel


Responses

Posted by: Savariya on: 3/28/2012 [Member] Starter | Points: 50

Up
0
Down

Resolved
int.Parse is a simple method used to convert string to integer. It throws exception when null or invalid input is provided. Hence it is slow.

int.TryParse does not thow any exception instead we must describe second parameter as out parameter which holds result. And it returns boolean value representing success or failure.



http://www.codeproject.com/Articles/32885/Difference-Between-Int32-Parse-Convert-ToInt32-and

Go through this link it will perfectly answer your question

Thanks
Chintan

Patel28rajendra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Patel28rajendra on: 3/28/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

Chintan

Thanks for your reply

R D Patel

Patel28rajendra, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sabarimahesh on: 3/28/2012 [Member] Bronze | Points: 25

Up
0
Down
Hi Patel28rajendra
Refer This link Dude
http://www.dotnetfunda.com/blogs/sabarimahesh/2152/difference-between-int32parse-int32tryparse-and-converttoint32

Life is a Race
Thanks & Regards
By
Sabari Mahesh P M

Patel28rajendra, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response