String vs string in c#

How do you create a string variable in c# ?

String ? string ?

Confused with the above text . Well its just that we use either the keyword string or we use String .

Is both String and string same in C# ?

string is just an alias name for the class System.String which means both has the same functionalities .The IL code generated for both of them is also same .

Note that string is a keyword , but String isn’t which lets you create an indentifier with the name String like

String String ="Senthil kumar" ;
C# String Theory—string versus String has some interesting information about Strings and best practises on strings
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.


  1. MichaelM April 15, 2011 Reply
  2. Ryukk April 15, 2011 Reply
  3. Preeti Chauhan Kohli May 4, 2011 Reply
  4. String vs string in C# | ProgramInDotnet August 8, 2011 Reply

Leave a Reply


Interesting BlogPosts to read

Event on Building intelligent bots with the Microsoft Bot Framework in Manchester
Want to learn about building intelligent bots using Microsoft's Bot Framework. Here's an interesting...
Barracuda Introduces Email Threat Scan for Microsoft Office 365
With the number of advanced threats on the rise and affecting companies of all sizes, Barracuda toda...
How to get an Enumerator from range of elements from ArrayList in C# ?
The code snippet shown in this blog post demonstrates how you can get the enumeraor from a range of ...