System.Xml.Xsl.Runtime.XmlQueryRuntime.AddNewIndex C# (CSharp) Method

AddNewIndex() public method

Add a newly built index over the specified "context" document to the existing collection of indexes.
public AddNewIndex ( XPathNavigator context, int indexId, XmlILIndex index ) : void
context System.Xml.XPath.XPathNavigator
indexId int
index XmlILIndex
return void
        public void AddNewIndex(XPathNavigator context, int indexId, XmlILIndex index) {
            XPathNavigator navRoot;
            ArrayList docIndexes;
            Debug.Assert(context != null);

            // Get root of document
            navRoot = context.Clone();
            navRoot.MoveToRoot();

            // Ensure that a slot exists for the new index
            if (this.indexes == null) {
                this.indexes = new ArrayList[indexId + 4];
            }
            else if (indexId >= this.indexes.Length) {
                // Resize array
                ArrayList[] indexesNew = new ArrayList[indexId + 4];
                Array.Copy(this.indexes, 0, indexesNew, 0, this.indexes.Length);
                this.indexes = indexesNew;
            }

            docIndexes = (ArrayList) this.indexes[indexId];
            if (docIndexes == null) {
                docIndexes = new ArrayList();
                this.indexes[indexId] = docIndexes;
            }

            docIndexes.Add(navRoot);
            docIndexes.Add(index);
        }