public override VirtualChar this[int index] { get { #if DEBUG // We should never have a property paired high/low surrogate in a StringChunk. We are only created // when the string has the same number of chars as there are VirtualChars. if (char.IsHighSurrogate(_underlyingData[index])) { Debug.Assert( index + 1 >= _underlyingData.Length || !char.IsLowSurrogate(_underlyingData[index + 1]) ); } #endif var span = new TextSpan(_firstVirtualCharPosition + index, length: 1); var ch = _underlyingData[index]; return(char.IsSurrogate(ch) ? VirtualChar.Create(ch, span) : VirtualChar.Create(new Rune(ch), span)); } }
public bool Contains(VirtualChar @char) => IndexOf(@char) >= 0;
public abstract bool TryGetEscapeCharacter(VirtualChar ch, out char escapedChar);