Unlike C and C++, the underlying character type in a string is a 16 bit Unicode char. Mixing 16 bit chars with 8 bit chars from unmanaged code can be done but if you're used to 8 bit chars, there is a subtle difference and you need to call conversion routines.
The other thing about a C# string is that it is immutable which means read-only. Once you have assigned it, you can't change the original string value. If you try to alter it in some way, perhaps by appending another string it creates a new string. This can be very inefficient if done a lot but there is a StringBuilder class that will overcome that. More on that later in this tutorial.
Assigning A StringC# lets you assign a string as you'd expect -
A string is a reference type and the text is stored somewhere in memory where we don't have to concern ourselves with it.
public string MyString= "A String";
Examples of Assigning String LiteralsThese are valid string values.
Use " (double quotes) instead of ' inside a verbatim string. If you are using text not containing any backslashes then the regular strings (without the @) are probably best. Use verbatim strings for file paths.
"c:\\fred\\file.txt" - The \\ is treated as a single \. (See Strings and Characters on the next page) @"c:\fred\file.txt" - This is @quoted and the backslah \ is not processed. Microsoft call this a verbatim string. The backslashes are treated as characters not escape codes.
On the next page Strings and Chars