System.Xml.XmlException.BuildCharExceptionArgs C# (CSharp) Méthode

BuildCharExceptionArgs() static private méthode

static private BuildCharExceptionArgs ( char invChar, char nextChar ) : string[]
invChar char
nextChar char
Résultat string[]
        internal static string[] BuildCharExceptionArgs(char invChar, char nextChar)
        {
            string[] aStringList = new string[2];

            // for surrogate characters include both high and low char in the message so that a full character is displayed
            if (XmlCharType.IsHighSurrogate(invChar) && nextChar != 0)
            {
                int combinedChar = XmlCharType.CombineSurrogateChar(nextChar, invChar);
                aStringList[0] = new string(new char[] { invChar, nextChar });
                aStringList[1] = string.Format(CultureInfo.InvariantCulture, "0x{0:X2}", combinedChar);
            }
            else
            {
                // don't include 0 character in the string - in means eof-of-string in native code, where this may bubble up to
                if ((int)invChar == 0)
                {
                    aStringList[0] = ".";
                }
                else
                {
                    aStringList[0] = invChar.ToString();
                }
                aStringList[1] = string.Format(CultureInfo.InvariantCulture, "0x{0:X2}", (int)invChar);
            }
            return aStringList;
        }

Same methods

XmlException::BuildCharExceptionArgs ( char data, int invCharIndex ) : string[]
XmlException::BuildCharExceptionArgs ( char data, int length, int invCharIndex ) : string[]
XmlException::BuildCharExceptionArgs ( string data, int invCharIndex ) : string[]

Usage Example

Exemple #1
0
        private void CheckWhitespace(string value)
        {
            int invCharIndex = this.xmlCharType.IsOnlyWhitespaceWithPos(value);

            if (invCharIndex != -1)
            {
                this.Throw("Xml_InvalidWhitespaceCharacter", XmlException.BuildCharExceptionArgs(value, invCharIndex));
            }
        }
All Usage Examples Of System.Xml.XmlException::BuildCharExceptionArgs