the pros and cons of using high and low surrogate characters
Ask by ICSM Computer
Updated 03 Jun 2025
Here’s a breakdown of the pros and cons of using high and low surrogate characters in .NET (and UTF-16 in general):
Pros of High/Low Surrogate Characters
U+FFFF, including emojis, ancient scripts, and symbols like𝄞,🧠, or🧑💻.char, keeping memory usage low.Cons of High/Low Surrogate Characters
string.Lengthequals the number of characters. A surrogate pair counts as 2chars.char.IsHighSurrogateorStringInfomust be used to process full Unicode characters safely.Example Problem
To properly handle characters:
Summary