CSharp String Theory—string versus String
From C# Online.NET (CSharp-Online.NET)—your free C# and .NET encyclopedia
| CSharp-Online.NET:Articles |
| C# Articles |
| edit |
[edit]
string versus String
If you are new to C#, you are probably wondering what the difference is between the string and String types. In the .NET framework, string is simply an alias—shorthand—for the Common Type System (CTS) System.String class which represents a sequence of characters. (string is one of two predefined C# reference types: The other is object.) You can use them interchangeably in your code.
String x = string.Copy ("x"); string y = String.Copy ("y");
[edit]
Visual C# Best Practices
- Use "
String" to refer specifically to theStringclass. - Use "
string" when referring to an object of theStringclass.
|

