What is difference between Convert.ToString(variable) and
variable.ToString()
Answer Posted / abdul
Convert.ToString handles null where as simple
variable.ToString() doesn;t;
But Convert class is an optimization cost, when we use
inside any loop, need to minimize it
Sample ToString();
Will Work
int salary = 10000;
string oldSalary = salary.tostring();
Will Throw exeption
int salary = null;
string oldSalary = salary.tostring(); ---> throws exception
Sample Convert.ToString()
Will Work
int salary = 10000;
string oldSalary = Convert.ToString(salary);
Will Work
int salary = null;
string oldSalary = Convert.ToString(salary); null will return
Is This Answer Correct ? | 13 Yes | 7 No |
Post New Answer View All Answers
Hi to all..I have to create an intranet application on C#.NET windows Application so please please let can you people help me as iam new in .NET and if u have any samples or website address from where i can get sample please let know.
Explain the ways to deploy an assembly?
What are the types of delegates in c#?
In .NET which is the smallest unit of execution?
How do I make a dll in c#?
What is a interface in c#?
What are native functions?
How to Install uninstall assemblies into GAC?
Can you store strings in arrays?
What is the difference between Java and .NET garbage collectors?
How is a loop recorder monitored?
What is new method in c#?
What can be done with c#?
Are c and c# the same thing?
Which class does the remote object has to inherit?