What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 28758 |  Welcome, Guest!   Register  Login
 Home > Interview Questions > ASP.NET Interview Questions > Difference between Convert.ToString() an ...

Difference between Convert.ToString() and object.ToString()

Interview question and answer by: Rajni.Shekhar | Posted on: 3/19/2012 | Category: ASP.NET Interview questions | Views: 1820 | | Points: 40


Answer:

object.ToString() give run time error if object value is null, whereas Convert.ToString(object) does not give any error in case of object value is null;

Example:
object obj=null;
string str=obj.ToTsirng(); //it will give run time error
string str1=Convert.ToString(obj); // it will run, not give any error

Asked In: Many Interviews | Alert Moderator 
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

Even more ... | Submit Interview Questions and win prizes!

More Interview Questions from Rajni.Shekhar

Even more ... | Submit Interview Questions and win prizes!


About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 3:41:06 AM