Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is a console application in c#?

901


Why do we need delegates in c#?

910


What are the Types of values mode can hold session state in web.config

944


Can multiple inheritance implemented in c# ?

867


What are the 2 broad classifications of fields in c#?

887


What is jagged array?

877


What are the differences between static, public and void in c#?

987


What are the two uses of a ‘using’ statement in c#?

897


Is array thread safe c#?

818


How can I use .NET components from COM programs?

840


Explain the accessibility modifier protected internal?

802


Why do I get a syntax error when trying to declare a variable called checked?

947


What does == mean in c sharp?

929


List some of the basic string operation?

871


What is a static class in c#?

932