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 difference between var dynamic and object in c#?

896


What is the property of class?

1007


What is the difference between structure and class in c#?

914


What is tuple in c#?

875


We cannot create instances of static classes. Can we have constructors for static classes?

959


What is uint c#?

860


What is the main purpose of delegates in c#?

922


How to get the sum of last 3 items in a list using lambda expressions?

897


How do I format a string in c#?

813


When should I use static in C#?

943


Can we inherit sealed class in c#?

837


What is console writeline in c#?

834


How Global.asax is used ?

1014


Do void methods have parameters?

912


What is executescalar in c#?

803