Reputation: 131
I remember using Unicode string in C++ such as this:
std::wstring str = _T("a string here");
What is the equivalent in C#?
Upvotes: 2
Views: 20014
Reputation: 5957
Use System.Text.UnicodeEncoding class. This handles UTF-16 encoding of Unicode characters.
Upvotes: 0
Reputation: 40506
The equivalent in C# is the String
class.
According to MSDN:
(A String) Represents text as a series of Unicode characters.
[...] Each code point is encoded using UTF-16 encoding
So, if you do string str = "a string here";
, you have a Unicode string.
Upvotes: 9