Difference Between Tostring() And Convert.ToString



In this post, I will tell u the difference between tostring() and convert.tostring().
These two methods is the same but the main difference is tostring() is not allowing a null object to convert into a string.it will throw a null exception Error and the convert.tostring() is allow a null object to convert into a string.

Let We Understand By using these two examples

EX:
int a=null;
int b=null;
string c;
string d;
c=convert.tostring(b);
d=a.tostring(); 

here we have two variables a and, b. both variables a and, b are null.
 now we are converting both variables into string format c is converting b into a string whenever d is throwing a null Exception Error Because tostring() method is not allowing the null value to convert into a string.