-----------------------------------------------------------

New Message on MumbaiUserGroup

-----------------------------------------------------------
From: softsenthilv
Message 2 in Discussion

 Difference between Convert.ToInt32 and int.Parse  
Both(Convert.ToInt32 and int.Parse) will return the same resule in
most of the cases. But null is handled differently.
Consider the following example…

string strCount="32";
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount);

If you print the result it will be same ie 32.

If suppose the string is the null (see the example below),
Convert.ToInt32 will return zero.
but the int.Parse will throw ArgumentNullException error.

string strCount=null;
int count1 = Convert.ToInt32(strCount);
int count2 = int.Parse(strCount); // ArgumentNullException error

If you don't assign (initialize) null to the strCount the code will
not compile.
Because in C# variable must be initialized before use. 
  
Thanks, 
Senthil kumar V

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member 
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you 
received this message by mistake, please click the "Remove" link below. On the 
pre-addressed e-mail message that opens, simply click "Send". Your e-mail 
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]
  • basic query TelegenicVamsiSridhara
    • Re: basic query softsenthilv

Reply via email to