Difference between string and String
 
Author:
Filed Under: C#.Net  |  VB.Net
Published Date: Jan 04, 2011
Views: 2181
 

Abstract: Here Mudassar Ahmed Khan has explained the difference between string and String keywords in C# and also the difference between bool and Boolean class.

Comments:  1

 

This is a short knowledge base article where I would like to clear a common doubt which I also faced when I was new.
1. What is the difference between string and String?
2. Which one to use and when?
So the answer is both are one and the same and both can be used. But it is recommended to use the shorter version i.e. string as that is the alias for the class System.String.
In other words the String represents the System.String class while the string is the keyword for the System.String that we can use to create string objects.
Here’s the MSDN reference for the different keywords for different classes Built-In Types Table
This same explanation can be used to explain the difference between bool and Boolean
With this we come to the end of this short article. Hope you like it.








Related Articles



Comments



Add comments

You can add your comment about this article using the form below. Make sure you provide a valid email address
else you won't be notified when the author replies to your comment

Please note that all comments are moderated and will be deleted if they are
  • Not relavant to the article
  • Spam
  • Advertising campaigns or links to other sites
  • Abusive content.
Please do not post code, scripts or snippets.

Name*: Required
Email*: Required
Comment*: Required
Security code*: CaptchaInvalid Security Code
  Submit