| CodeGuru Home | VC++ / MFC / C++ | .NET / C# | Visual Basic | Newsletters | VB Forums | Developer.com |
|
|||||||
| C-Sharp Programming Post questions, answers, and comments about C#. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Int.Parse vs. Convert.To
Hey,
Could someone please explain what is the differance between: int x = intParse(txtNum1.txt); int x = Convert.ToInt32(txtNum1.txt); Thanks, Dan. |
|
#2
|
|||
|
|||
|
Re: Int.Parse vs. Convert.To
Int32.Parse - http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx
Convert.ToInt32 - http://msdn.microsoft.com/en-us/libr...8VS.71%29.aspx The Convert class is capable of converting more types of data representations to an integer than Parse, which deals only with strings. |
|
#3
|
||||
|
||||
|
Re: Int.Parse vs. Convert.To
There's no difference, Conver.ToInt32() internaly uses Int32.Parse(). Covert is just facade over various types. Int32(16,64) and so on provides, in addition to Convert's methods, TryParse family of safe method which not throw an exception.
__________________
|
|
#4
|
|||
|
|||
|
Re: Int.Parse vs. Convert.To
Yes, the difference is over what class is being called, the outcome offers no difference
|
![]() |
| Bookmarks |
|
||||||
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|