Tuesday, 12 June 2012

What is the difference between Convert.Tostring() and Tostring ()


int j =0;
MessageBox.Show(j.ToString());
MessageBox.Show(Convert.ToString(j));
We can convert the integer “j” using “j.ToString()” or “Convert.ToString” so what’s the difference.
The basic difference between them is  Convert.ToString() return string.Empty in case of null object  while “j.ToString()”
ToString() raise exception when the object is null

No comments:

Post a Comment