public string GetString()
        {
            if (_tokenType == BinaryTokenType.Null)
            {
                return(null);
            }

            if (TokenType != BinaryTokenType.Bytes)
            {
                throw ThrowHelper.GetInvalidOperationException_ExpectedString(TokenType);
            }

            ReadOnlySpan <byte> span = ValueSpan;

            return(BinaryReaderHelper.TranscodeHelper(span));
        }
        internal static BinaryPropertyInfo LookupProperty(
            object obj,
            ReadOnlySpan <byte> unescapedPropertyName,
            ref ReadStack state,
            out bool useExtensionProperty,
            bool createExtensionProperty = true)
        {
            Debug.Assert(state.Current.BinaryClassInfo.ClassType == ClassType.Object || state.Current.BinaryClassInfo.ClassType == ClassType.Enumerable || state.Current.BinaryClassInfo.ClassType == ClassType.Dictionary);

            useExtensionProperty = false;

            BinaryPropertyInfo binaryPropertyInfo = state.Current.BinaryClassInfo.GetProperty(
                unescapedPropertyName,
                ref state.Current,
                out byte[] utf8PropertyName);

            // Increment PropertyIndex so GetProperty() checks the next property first when called again.
            state.Current.PropertyIndex++;

            // For case insensitive and missing property support of BinaryPath, remember the value on the temporary stack.
            state.Current.BinaryPropertyName = utf8PropertyName;

            // Determine if we should use the extension property.
            if (binaryPropertyInfo == BinaryPropertyInfo.s_missingProperty)
            {
                BinaryPropertyInfo dataExtProperty = state.Current.BinaryClassInfo.DataExtensionProperty;
                if (dataExtProperty != null && dataExtProperty.HasGetter && dataExtProperty.HasSetter)
                {
                    state.Current.BinaryPropertyNameAsString = BinaryReaderHelper.TranscodeHelper(unescapedPropertyName);

                    if (createExtensionProperty)
                    {
                        CreateDataExtensionProperty(ref state, obj, dataExtProperty);
                    }

                    binaryPropertyInfo   = dataExtProperty;
                    useExtensionProperty = true;
                }
            }

            state.Current.BinaryPropertyInfo = binaryPropertyInfo;
            return(binaryPropertyInfo);
        }