public static StringBuilder AppendCodePoint(this StringBuilder s, int c)
{
if ((uint)c <= 0xFFFF)
s.Append((char)c);
else if ((uint)c <= 0x10FFFF)
{
c -= 0x10000;
s.Append((char)((c >> 10) | 0xD800));
s.Append((char)((c & 0x3FF) | 0xDC00));
}
else
throw new ArgumentOutOfRangeException("Invalid unicode character: {0}".Localized(c));
return s;
}
}