System.Xml.CharEntityEncoderFallback.CanReplaceAt C# (CSharp) Méthode

CanReplaceAt() private méthode

private CanReplaceAt ( int index ) : bool
index int
Résultat bool
        internal bool CanReplaceAt( int index ) {
            int mPos = curMarkPos;
            int charPos = startOffset + index;
            while ( mPos < endMarkPos && charPos >= textContentMarks[mPos+1] ) {
                mPos++;
            }
            curMarkPos = mPos;

            return (mPos & 1) != 0;
        }
    }

Usage Example

            public override bool Fallback(char charUnknown, int index)
            {
                // If we are already in fallback, throw, it's probably at the suspect character in charEntity
                if (_charEntityIndex >= 0)
                {
                    (new EncoderExceptionFallback()).CreateFallbackBuffer().Fallback(charUnknown, index);
                }

                // find out if we can replace the character with entity
                if (_parent.CanReplaceAt(index))
                {
                    // Create the replacement character entity
                    _charEntity      = string.Create(null, stackalloc char[64], $"&#x{(int)charUnknown:X};");
                    _charEntityIndex = 0;
                    return(true);
                }

                EncoderFallbackBuffer errorFallbackBuffer = (new EncoderExceptionFallback()).CreateFallbackBuffer();

                errorFallbackBuffer.Fallback(charUnknown, index);
                return(false);
            }
All Usage Examples Of System.Xml.CharEntityEncoderFallback::CanReplaceAt