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 poco c#?

901


What can we do to handle multiple exceptions?

1033


Is it possible to have different access modifiers on the get/set methods of a property?

1023


What is token in c#?

977


Is php better than c#?

916


Why is it not a good idea to use empty destructors?

1036


What is the use of getcommandlineargs() method in c#.net?

972


Which language is used for desktop application?

954


What is dapper in c#?

943


Can non-default constructors be used with single call sao?

1023


What is the default value of date?

937


how to stored and retrive video in Sql server using asp.net c#......?

990


Can you explicitly call a destructor?

925


What is windows form in c#?

1022


What are the properties of c#?

988