Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Difference between String.Convert Vs String.ToString within the C# forums, part of the Software Development category; Hi Please explain the Difference between Convert Vs String.ToString...
|
|||||||
|
|||
|
Difference between String.Convert Vs String.ToString
Hi
Please explain the Difference between Convert Vs String.ToString Last edited by jbanx; 02-22-2007 at 02:12 AM. |
| The Following User Says Thank You to jbanx For This Useful Post: | ||
| Sponsored Links |
|
|||
|
Re: Difference between String.Convert Vs String.ToString
Hi,
Diffrence between string.convert vs string.tostring is here tostring doesnot handle null values where as covert handle null values. Regards, hari prasad |
| The Following 2 Users Say Thank You to hari.nattuva For This Useful Post: | ||
|
|||
|
Re: Difference between String.Convert Vs String.ToString
To tell you more Convert internally uses toString. In convert first there is a check for null, if there is null then string.empty is returned, else normal toString method is called
|
|
|||
|
Re: Difference between String.Convert Vs String.ToString
Quote:
convert the string from one to another. String.toString: divide the string into sub string |
|
|||
|
Re: Difference between String.Convert Vs String.ToString
See the example.
Line 1 :String str1 = null; Line 2: Console.WriteLine("->" + Convert.ToString(str1) + "<-"; Line 3: Console.WriteLine("->" + str1.ToString() + "<-"); In the above example, Line 2 will display the result("-><-"), because Convert.ToString() handle NULL. Line 3 will throw NullReferenceException because .ToString() does not handle NULL. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| VisiFly is an easy-to-use program to convert your video files into streaming Flash st | JobHelper | Geeks Lounge | 0 | 02-12-2007 06:21 AM |
| Convert PowerPoint into video | JobHelper | Geeks Lounge | 0 | 02-09-2007 06:01 PM |
| Getting exact recognition string | JobHelper | Rational Robot | 0 | 01-06-2007 01:32 AM |
| String handling function in C | scott | C and C++ | 1 | 07-23-2006 12:22 PM |
| String into Long | norman | C and C++ | 2 | 07-13-2006 10:51 PM |