Strings

The .NET Framework represents strings as Unicode characters. In C#, the keyword string is an alias for System.String. Therefore, the following declarations are equivalent in C#:

string sMyString = "Some string value";

System.String sAnotherString = "Some other string value";

Because the keyword string is an alias for System.String, strings are technically reference types in .NET. The == and != operators are overloaded regarding strings, so comparison of string values is more intuitive.

One benefit of basing the string type on the System.String class is that you have access to a rich set of static methods for manipulating and comparing strings. Table A.3 shows some of the common String object methods, a description of their use, and ...

Get Building e-Commerce Sites with the .NET Framework now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.