difference between Convert.toString and .toString in .Net

There a lot of confusion that what is the difference between convert.toString and .toString my friend always asked me about that just to give an understanding of what the above question means see the below code.

int i = 0; 

We can convert the integer “i” using “i.ToString()” or “Convert.ToString” so what is the difference. The basic difference between them is “Convert” function handles NULLS while “i.ToString()” does not it will throw a NULL reference exception error. So as a good coding practice using “convert” is always safe.

string str = NULL; 
MessageBox.Show(str.ToString());  //throw an Error

Recent Posts