System.Xml.XmlWellFormedWriter.CheckNCName C# (CSharp) Méthode

CheckNCName() private méthode

private CheckNCName ( string ncname ) : void
ncname string
Résultat void
        private unsafe void CheckNCName(string ncname)
        {
            Debug.Assert(ncname != null && ncname.Length > 0);

            int i;
            int endPos = ncname.Length;

            // Check if first character is StartNCName (inc. surrogates)
            if (_xmlCharType.IsStartNCNameSingleChar(ncname[0]))
            {
                i = 1;
            }
#if XML10_FIFTH_EDITION
            else if (_xmlCharType.IsNCNameSurrogateChar(ncname, 0))
            { // surrogate ranges are same for NCName and StartNCName
                i = 2;
            }
#endif
            else
            {
                throw InvalidCharsException(ncname, 0);
            }

            // Check if following characters are NCName (inc. surrogates)
            while (i < endPos)
            {
                if (_xmlCharType.IsNCNameSingleChar(ncname[i]))
                {
                    i++;
                }
#if XML10_FIFTH_EDITION
                else if (xmlCharType.IsNCNameSurrogateChar(ncname, i))
                {
                    i += 2;
                }
#endif
                else
                {
                    throw InvalidCharsException(ncname, i);
                }
            }
        }