public Utf8EncodedCodePoint ( char character ) : System.Runtime.InteropServices | ||
character | char | |
return | System.Runtime.InteropServices |
public Utf8EncodedCodePoint(char character) : this()
{
if (char.IsSurrogate(character))
{
throw new ArgumentOutOfRangeException("character", "Surrogate characters are not allowed");
}
UnicodeCodePoint codePoint = (UnicodeCodePoint)(uint)character;
unsafe
{
fixed (byte* encodedData = &_byte0)
{
var buffer = new Span<byte>(encodedData, 4);
if (!Utf8Encoder.TryEncodeCodePoint(codePoint, buffer, out _length))
{
// TODO: Change exception type
throw new Exception("Internal error: this should never happen as codePoint is within acceptable range and is not surrogate");
}
}
}
}
Utf8EncodedCodePoint::Utf8EncodedCodePoint ( char highSurrogate, char lowSurrogate ) : System.Runtime.InteropServices |