What is difference between Convert.ToString(variable) and
variable.ToString()

Answer Posted / pavel

object ss =null;

string s1 = ss.ToString(); ---------- exeption
string s2 = Convert.ToString(ss); --- ""

--------------------
int ss =null; --- int can't be converted to null

--------------------
int ss = 1;

string s1 = ss.ToString(); ---------- "1"
string s2 = Convert.ToString(ss); --- "1"

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of the integer parse method the decimal parse method?

738


What is namespace c#?

650


Where do we set the min and max pool size for connection pooling?

700


What does it mean?

695


What is serialization in c#?

640






What is string pool in c#?

734


Why do we need constructor?

651


What is tryparse?

703


Which is better javascript or c#?

657


Can abstract class be sealed?

630


What are properties in c#. Explain with an example?

636


What is join in c#?

665


Is c and c# the same?

659


Is vs as c#?

677


Why do we need generics?

678