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

AddNamespace() private méthode

private AddNamespace ( string prefix, string ns, NamespaceKind kind ) : void
prefix string
ns string
kind NamespaceKind
Résultat void
        private void AddNamespace(string prefix, string ns, NamespaceKind kind)
        {
            int top = ++_nsTop;
            if (top == _nsStack.Length)
            {
                Namespace[] newStack = new Namespace[top * 2];
                Array.Copy(_nsStack, newStack, top);
                _nsStack = newStack;
            }
            _nsStack[top].Set(prefix, ns, kind);

            if (_useNsHashtable)
            {
                // add last
                AddToNamespaceHashtable(_nsTop);
            }
            else if (_nsTop == MaxNamespacesWalkCount)
            {
                // add all
                _nsHashtable = new Dictionary<string, int>(_hasher);
                for (int i = 0; i <= _nsTop; i++)
                {
                    AddToNamespaceHashtable(i);
                }
                _useNsHashtable = true;
            }
        }