コード例 #1
0
        public static Rune FromUtf8(byte[] value, ref int index)
        {
            if (index >= value.Length)
            {
                throw new ArgumentOutOfRangeException("index", "Index out of bounds.");
            }

            var leading = value[index++];

            if (!Utf8.ProcessLeading(leading, out var result, out var bytesRemaining))
            {
                while (Utf8.ProcessTrailing(leading, ref result, ref bytesRemaining))
                {
                    ;
                }
            }

            return(new Rune(result));
        }