Follow in Twitter & Facebook



Like in Facebook

Powered By Blogger Widgets

Free Download

FREE Tools



Wednesday, April 18, 2012

Difference between ToString() vs Convert.ToString() in C#.Net

Here we will discuss what is the difference between ToString() vs Convert.ToString() in C#.Net. Also you can check my last article on Strings and StringBuilder in C# and Delete and Truncate in sql server 2008.

Very often we use ToString() and Convert.ToString() methods in C#.Net code. But it is important to know the difference between these two.

Convert.ToString() supports null whereas .ToString() will not support null. Means Convert.ToString() return string.Empty in case of null object but ToString() raise exception when the object is null.

So it is better to use Convert in C#.Net code always for good programming practice.

Also you can check Asp.Net cookies Advantages and disadvantages and a very good article on Delegates in C#.net.




0 on: "Difference between ToString() vs Convert.ToString() in C#.Net"