If you declare a string variable and don't assign any value in C#. Then by default it take a blank or null value itself . in this case if u use .ToString() method then our program should throw null reference exception. and in Convert.ToString() our program doesn't throw any exception. bcoz by default it takes a blank value instead of null.
see the code example . u will get a clear view.
using System;
using System.Collections.Generic;using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace csharpExamples
{class Program
{
static void Main(string[] args)
{
string abc = "" ;
abc = null;
Console.Write(abc.ToString());
Console.ReadKey();
}
}
And if u use Convert.ToString() . then u need to change this line of code ..
Console.Write(abc.ToString()); to Console.Write(Convert.ToString(abc));
to see the output of above program..


Eklavya GuptaPosted Jun 28, 2014, 2:42 PM
Hey Surya, I understood what your your blog wanted to communicate and indeed it was good. The suggestion was to make your already good blog more Technically correct....but as for any suggestion you are free to ignore my comment :)
Jatin GadhiyaPosted Jun 28, 2014, 5:03 AM
nice thing
Surya Prakash PandeyPosted Jun 25, 2014, 11:59 PM
Hi. Eklavya Gupta .. u r right but i am trying to explain the differences between .ToString() and Convert.ToString() . u have a lots of option to do any thing in C# or any languages... i think u got it ... what i am trying to say .. thanks
Eklavya GuptaPosted Jun 25, 2014, 7:05 PM
There is no need to do ToString() or Convert.ToString() for strings. It would be better to take an object or nullable value types in the example above.
Surya Prakash PandeyPosted Jun 25, 2014, 7:18 AM
Hi keyur .. i have attached the output image in codescreenshot.rar file..u can check it...
Keyur PatelPosted Jun 25, 2014, 7:06 AM
Hi Surya, Welcome to the C-sharpcorner :-). I think, you forgot to put output image.