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

Why do we need constructor?

467


Why c# is type safe?

508


What is uint c#?

444


Is the following code legal?

542


What are expressions c#?

459






What is the purpose of namespace in c#?

433


What floating point types is supported in C#?

574


Why do we need reflection in c#?

461


Can you store different types in an array in c#?

458


What is the purpose of a console table?

450


What is the difference between system.text.stringbuilder and system.string?

511


Explain the process of abstraction with an example?

483


Is array passed by reference in c#?

498


What are synchronous and asynchronous operations?

460


What is array formula?

438