Difference
Moderator: General Moderators
-
DennisManley
- Forum Newbie
- Posts: 1
- Joined: Sat Nov 14, 2015 3:30 am
Difference
What is the difference between Convert.toString and .toString() method actually I am learning coding that's why asking these basic questions.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Difference
Convert is a system object that provides many methods to convert variables from one type to another. The .toString() method is available in some object types to return the contents of the object as a string. The main practical difference is that .toString() has to be called on an object, whereas you can pass Convert.toString() a variable that cannot be converted to a string or is null.
(#10850)
Re: Difference
Hey,
Convert.ToString() handles null, while ToString() doesn't.
Convert.ToString() handles null, while ToString() doesn't.