Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 C# 中如何表示 4 个字节的字符?像一个字符或一组 2 个字符?
var someCharacter = 'x'; //put 4 bytes UTF-16 character
C# 只能在类型中存储来自基本多语言平面char的字符。对于此平面之外的字符char,必须使用两个 s - 称为代理。
char
您还可以使用字符串文字,例如:
string s = "\U0001D11E";
请参阅UTF-16。