Difference

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
DennisManley
Forum Newbie
Posts: 1
Joined: Sat Nov 14, 2015 3:30 am

Difference

Post by DennisManley »

What is the difference between Convert.toString and .toString() method actually I am learning coding that's why asking these basic questions.
User avatar
Christopher
Site Administrator
Posts: 13595
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Difference

Post by Christopher »

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)
Swhite
Forum Newbie
Posts: 7
Joined: Thu Feb 04, 2016 1:19 am

Re: Difference

Post by Swhite »

Hey,
Convert.ToString() handles null, while ToString() doesn't.
Post Reply