The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.Runtime \ XmlQueryItemSequence

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlQuerySequence.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. using System;
  16. using System.Collections;
  17. using System.Collections.Generic;
  18. using System.Xml;
  19. using System.IO;
  20. using System.Text;
  21. using System.Xml.Schema;
  22. using System.Xml.Xsl;
  23. using System.Xml.XPath;
  24. using System.Diagnostics;
  25. using System.ComponentModel;
  26. namespace System.Xml.Xsl.Runtime
  27. {
  28.     using Res = System.Xml.Utils.Res;
  29.    
  30.     /// <summary>
  31.     /// A sequence of Xml values that dynamically expands and allows random access to items.
  32.     /// </summary>
  33.     [EditorBrowsable(EditorBrowsableState.Never)]
  34.     public class XmlQuerySequence<T> : IList<T>, System.Collections.IList
  35.     {
  36.         public static readonly XmlQuerySequence<T> Empty = new XmlQuerySequence<T>();
  37.        
  38.         private static readonly Type XPathItemType = typeof(XPathItem);
  39.        
  40.         private T[] items;
  41.         private int size;
  42.        
  43.         #if DEBUG
  44.         private const int DefaultCacheSize = 2;
  45.         #else
  46.         private const int DefaultCacheSize = 16;
  47.         #endif
  48.        
  49.         /// <summary>
  50.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQuerySequence.
  51.         /// </summary>
  52.         public static XmlQuerySequence<T> CreateOrReuse(XmlQuerySequence<T> seq)
  53.         {
  54.             if (seq != null) {
  55.                 seq.Clear();
  56.                 return seq;
  57.             }
  58.            
  59.             return new XmlQuerySequence<T>();
  60.         }
  61.        
  62.         /// <summary>
  63.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQuerySequence.
  64.         /// Add "item" to the sequence.
  65.         /// </summary>
  66.         public static XmlQuerySequence<T> CreateOrReuse(XmlQuerySequence<T> seq, T item)
  67.         {
  68.             if (seq != null) {
  69.                 seq.Clear();
  70.                 seq.Add(item);
  71.                 return seq;
  72.             }
  73.            
  74.             return new XmlQuerySequence<T>(item);
  75.         }
  76.        
  77.         /// <summary>
  78.         /// Construct new sequence.
  79.         /// </summary>
  80.         public XmlQuerySequence()
  81.         {
  82.             this.items = new T[DefaultCacheSize];
  83.         }
  84.        
  85.         /// <summary>
  86.         /// Construct new sequence.
  87.         /// </summary>
  88.         public XmlQuerySequence(int capacity)
  89.         {
  90.             this.items = new T[capacity];
  91.         }
  92.        
  93.         /// <summary>
  94.         /// Construct sequence from the specified array.
  95.         /// </summary>
  96.         public XmlQuerySequence(T[] array, int size)
  97.         {
  98.             this.items = array;
  99.             this.size = size;
  100.         }
  101.        
  102.         /// <summary>
  103.         /// Construct singleton sequence having "value" as its only element.
  104.         /// </summary>
  105.         public XmlQuerySequence(T value)
  106.         {
  107.             this.items = new T[1];
  108.             this.items[0] = value;
  109.             this.size = 1;
  110.         }
  111.        
  112.        
  113.         //-----------------------------------------------
  114.         // IEnumerable implementation
  115.         //-----------------------------------------------
  116.        
  117.         /// <summary>
  118.         /// Return IEnumerator implementation.
  119.         /// </summary>
  120.         System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
  121.         {
  122.             return new IListEnumerator<T>(this);
  123.         }
  124.        
  125.        
  126.         //-----------------------------------------------
  127.         // IEnumerable<T> implementation
  128.         //-----------------------------------------------
  129.        
  130.         /// <summary>
  131.         /// Return IEnumerator<T> implementation.
  132.         /// </summary>
  133.         public IEnumerator<T> GetEnumerator()
  134.         {
  135.             return new IListEnumerator<T>(this);
  136.         }
  137.        
  138.        
  139.         //-----------------------------------------------
  140.         // ICollection implementation
  141.         //-----------------------------------------------
  142.        
  143.         /// <summary>
  144.         /// Return the number of items in the sequence.
  145.         /// </summary>
  146.         public int Count {
  147.             get { return this.size; }
  148.         }
  149.        
  150.         /// <summary>
  151.         /// The XmlQuerySequence is not thread-safe.
  152.         /// </summary>
  153.         bool System.Collections.ICollection.IsSynchronized {
  154.             get { return false; }
  155.         }
  156.        
  157.         /// <summary>
  158.         /// This instance can be used to synchronize access.
  159.         /// </summary>
  160.         object System.Collections.ICollection.SyncRoot {
  161.             get { return this; }
  162.         }
  163.        
  164.         /// <summary>
  165.         /// Copy contents of this sequence to the specified Array, starting at the specified index in the target array.
  166.         /// </summary>
  167.         void System.Collections.ICollection.CopyTo(Array array, int index)
  168.         {
  169.             if (this.size == 0)
  170.                 return;
  171.            
  172.             Array.Copy(this.items, 0, array, index, this.size);
  173.         }
  174.        
  175.        
  176.         //-----------------------------------------------
  177.         // ICollection<T> implementation
  178.         //-----------------------------------------------
  179.        
  180.         /// <summary>
  181.         /// Items may not be added, removed, or modified through the ICollection<T> interface.
  182.         /// </summary>
  183.         bool ICollection<T>.IsReadOnly {
  184.             get { return true; }
  185.         }
  186.        
  187.         /// <summary>
  188.         /// Items may not be added through the ICollection<T> interface.
  189.         /// </summary>
  190.         void ICollection<T>.Add(T value)
  191.         {
  192.             throw new NotSupportedException();
  193.         }
  194.        
  195.         /// <summary>
  196.         /// Items may not be cleared through the ICollection<T> interface.
  197.         /// </summary>
  198.         void ICollection<T>.Clear()
  199.         {
  200.             throw new NotSupportedException();
  201.         }
  202.        
  203.         /// <summary>
  204.         /// Returns true if the specified value is in the sequence.
  205.         /// </summary>
  206.         public bool Contains(T value)
  207.         {
  208.             return IndexOf(value) != -1;
  209.         }
  210.        
  211.         /// <summary>
  212.         /// Copy contents of this sequence to the specified Array, starting at the specified index in the target array.
  213.         /// </summary>
  214.         public void CopyTo(T[] array, int index)
  215.         {
  216.             for (int i = 0; i < Count; i++)
  217.                 array[index + i] = this[i];
  218.         }
  219.        
  220.         /// <summary>
  221.         /// Items may not be removed through the ICollection<T> interface.
  222.         /// </summary>
  223.         bool ICollection<T>.Remove(T value)
  224.         {
  225.             throw new NotSupportedException();
  226.         }
  227.        
  228.        
  229.         //-----------------------------------------------
  230.         // IList implementation
  231.         //-----------------------------------------------
  232.        
  233.         /// <summary>
  234.         /// Items may not be added, removed, or modified through the IList interface.
  235.         /// </summary>
  236.         bool System.Collections.IList.IsFixedSize {
  237.             get { return true; }
  238.         }
  239.        
  240.         /// <summary>
  241.         /// Items may not be added, removed, or modified through the IList interface.
  242.         /// </summary>
  243.         bool System.Collections.IList.IsReadOnly {
  244.             get { return true; }
  245.         }
  246.        
  247.         /// <summary>
  248.         /// Return item at the specified index.
  249.         /// </summary>
  250.         object System.Collections.IList.this[int index]
  251.         {
  252.             get {
  253.                 if (index >= this.size)
  254.                     throw new ArgumentOutOfRangeException();
  255.                
  256.                 return this.items[index];
  257.             }
  258.             set {
  259.                 throw new NotSupportedException();
  260.             }
  261.         }
  262.        
  263.         /// <summary>
  264.         /// Items may not be added through the IList interface.
  265.         /// </summary>
  266.         int System.Collections.IList.Add(object value)
  267.         {
  268.             throw new NotSupportedException();
  269.         }
  270.        
  271.         /// <summary>
  272.         /// Items may not be cleared through the IList interface.
  273.         /// </summary>
  274.         void System.Collections.IList.Clear()
  275.         {
  276.             throw new NotSupportedException();
  277.         }
  278.        
  279.         /// <summary>
  280.         /// Returns true if the specified value is in the sequence.
  281.         /// </summary>
  282.         bool System.Collections.IList.Contains(object value)
  283.         {
  284.             return Contains((T)value);
  285.         }
  286.        
  287.         /// <summary>
  288.         /// Returns the index of the specified value in the sequence.
  289.         /// </summary>
  290.         int System.Collections.IList.IndexOf(object value)
  291.         {
  292.             return IndexOf((T)value);
  293.         }
  294.        
  295.         /// <summary>
  296.         /// Items may not be added through the IList interface.
  297.         /// </summary>
  298.         void System.Collections.IList.Insert(int index, object value)
  299.         {
  300.             throw new NotSupportedException();
  301.         }
  302.        
  303.         /// <summary>
  304.         /// Items may not be removed through the IList interface.
  305.         /// </summary>
  306.         void System.Collections.IList.Remove(object value)
  307.         {
  308.             throw new NotSupportedException();
  309.         }
  310.        
  311.         /// <summary>
  312.         /// Items may not be removed through the IList interface.
  313.         /// </summary>
  314.         void System.Collections.IList.RemoveAt(int index)
  315.         {
  316.             throw new NotSupportedException();
  317.         }
  318.        
  319.        
  320.         //-----------------------------------------------
  321.         // IList<T> implementation
  322.         //-----------------------------------------------
  323.        
  324.         /// <summary>
  325.         /// Return item at the specified index.
  326.         /// </summary>
  327.         public T this[int index]
  328.         {
  329.             get {
  330.                 if (index >= this.size)
  331.                     throw new ArgumentOutOfRangeException();
  332.                
  333.                 return this.items[index];
  334.             }
  335.             set {
  336.                 throw new NotSupportedException();
  337.             }
  338.         }
  339.        
  340.         /// <summary>
  341.         /// Returns the index of the specified value in the sequence.
  342.         /// </summary>
  343.         public int IndexOf(T value)
  344.         {
  345.             int index = Array.IndexOf(this.items, value);
  346.             return (index < this.size) ? index : -1;
  347.         }
  348.        
  349.         /// <summary>
  350.         /// Items may not be added through the IList<T> interface.
  351.         /// </summary>
  352.         void IList<T>.Insert(int index, T value)
  353.         {
  354.             throw new NotSupportedException();
  355.         }
  356.        
  357.         /// <summary>
  358.         /// Items may not be removed through the IList<T> interface.
  359.         /// </summary>
  360.         void IList<T>.RemoveAt(int index)
  361.         {
  362.             throw new NotSupportedException();
  363.         }
  364.        
  365.        
  366.         //-----------------------------------------------
  367.         // XmlQuerySequence methods
  368.         //-----------------------------------------------
  369.        
  370.         /// <summary>
  371.         /// Clear the cache.
  372.         /// </summary>
  373.         public void Clear()
  374.         {
  375.             this.size = 0;
  376.             OnItemsChanged();
  377.         }
  378.        
  379.         /// <summary>
  380.         /// Add an item to the sequence.
  381.         /// </summary>
  382.         public void Add(T value)
  383.         {
  384.             EnsureCache();
  385.             this.items[this.size++] = value;
  386.             OnItemsChanged();
  387.         }
  388.        
  389.         /// <summary>
  390.         /// Sort the items in the cache using the keys contained in the provided array.
  391.         /// </summary>
  392.         public void SortByKeys(Array keys)
  393.         {
  394.             if (this.size <= 1)
  395.                 return;
  396.            
  397.             Debug.Assert(keys.Length >= this.size, "Number of keys must be >= number of items.");
  398.             Array.Sort(keys, this.items, 0, this.size);
  399.             OnItemsChanged();
  400.         }
  401.        
  402.         /// <summary>
  403.         /// Ensure that an array of the specified type is created and has room for at least one more item.
  404.         /// </summary>
  405.         private void EnsureCache()
  406.         {
  407.             T[] cacheNew;
  408.            
  409.             if (this.size >= this.items.Length) {
  410.                 cacheNew = new T[this.size * 2];
  411.                 CopyTo(cacheNew, 0);
  412.                 this.items = cacheNew;
  413.             }
  414.         }
  415.        
  416.         /// <summary>
  417.         /// This method is called when one or more items in the cache have been added or removed.
  418.         /// By default, it does nothing, but subclasses can override it.
  419.         /// </summary>
  420.         protected virtual void OnItemsChanged()
  421.         {
  422.         }
  423.     }
  424.    
  425.     /// <summary>
  426.     /// A sequence of Xml items that dynamically expands and allows random access to items.
  427.     /// </summary>
  428.     [EditorBrowsable(EditorBrowsableState.Never)]
  429.     public sealed class XmlQueryItemSequence : XmlQuerySequence<XPathItem>
  430.     {
  431.         public static new readonly XmlQueryItemSequence Empty = new XmlQueryItemSequence();
  432.        
  433.         /// <summary>
  434.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQueryItemSequence.
  435.         /// </summary>
  436.         public static XmlQueryItemSequence CreateOrReuse(XmlQueryItemSequence seq)
  437.         {
  438.             if (seq != null) {
  439.                 seq.Clear();
  440.                 return seq;
  441.             }
  442.            
  443.             return new XmlQueryItemSequence();
  444.         }
  445.        
  446.         /// <summary>
  447.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQueryItemSequence.
  448.         /// Add "item" to the sequence.
  449.         /// </summary>
  450.         public static XmlQueryItemSequence CreateOrReuse(XmlQueryItemSequence seq, XPathItem item)
  451.         {
  452.             if (seq != null) {
  453.                 seq.Clear();
  454.                 seq.Add(item);
  455.                 return seq;
  456.             }
  457.            
  458.             return new XmlQueryItemSequence(item);
  459.         }
  460.        
  461.         /// <summary>
  462.         /// Construct sequence from the specified array.
  463.         /// </summary>
  464.         public XmlQueryItemSequence() : base()
  465.         {
  466.         }
  467.        
  468.         /// <summary>
  469.         /// Construct sequence with the specified initial capacity.
  470.         /// </summary>
  471.         public XmlQueryItemSequence(int capacity) : base(capacity)
  472.         {
  473.         }
  474.        
  475.         /// <summary>
  476.         /// Construct singleton sequence from a single item.
  477.         /// </summary>
  478.         public XmlQueryItemSequence(XPathItem item) : base(1)
  479.         {
  480.             AddClone(item);
  481.         }
  482.        
  483.         /// <summary>
  484.         /// Add an item to the sequence; clone the item before doing so if it's a navigator.
  485.         /// </summary>
  486.         public void AddClone(XPathItem item)
  487.         {
  488.             if (item.IsNode)
  489.                 Add(((XPathNavigator)item).Clone());
  490.             else
  491.                 Add(item);
  492.         }
  493.     }
  494.    
  495.     /// <summary>
  496.     /// A sequence of Xml nodes that dynamically expands and allows random access to items.
  497.     /// </summary>
  498.     [EditorBrowsable(EditorBrowsableState.Never)]
  499.     public sealed class XmlQueryNodeSequence : XmlQuerySequence<XPathNavigator>, IList<XPathItem>
  500.     {
  501.         public static new readonly XmlQueryNodeSequence Empty = new XmlQueryNodeSequence();
  502.        
  503.         private XmlQueryNodeSequence docOrderDistinct;
  504.        
  505.         /// <summary>
  506.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQueryNodeSequence.
  507.         /// </summary>
  508.         public static XmlQueryNodeSequence CreateOrReuse(XmlQueryNodeSequence seq)
  509.         {
  510.             if (seq != null) {
  511.                 seq.Clear();
  512.                 return seq;
  513.             }
  514.            
  515.             return new XmlQueryNodeSequence();
  516.         }
  517.        
  518.         /// <summary>
  519.         /// If "seq" is non-null, then clear it and reuse it. Otherwise, create a new XmlQueryNodeSequence.
  520.         /// Add "nav" to the sequence.
  521.         /// </summary>
  522.         public static XmlQueryNodeSequence CreateOrReuse(XmlQueryNodeSequence seq, XPathNavigator navigator)
  523.         {
  524.             if (seq != null) {
  525.                 seq.Clear();
  526.                 seq.Add(navigator);
  527.                 return seq;
  528.             }
  529.            
  530.             return new XmlQueryNodeSequence(navigator);
  531.         }
  532.        
  533.         /// <summary>
  534.         /// Construct sequence with the specified initial capacity.
  535.         /// </summary>
  536.         public XmlQueryNodeSequence() : base()
  537.         {
  538.         }
  539.        
  540.         /// <summary>
  541.         /// Construct sequence from the specified array.
  542.         /// </summary>
  543.         public XmlQueryNodeSequence(int capacity) : base(capacity)
  544.         {
  545.         }
  546.        
  547.         /// <summary>
  548.         /// Construct sequence from the specified array, cloning each navigator before adding it.
  549.         /// </summary>
  550.         public XmlQueryNodeSequence(IList<XPathNavigator> list) : base(list.Count)
  551.         {
  552.             for (int idx = 0; idx < list.Count; idx++)
  553.                 AddClone(list[idx]);
  554.         }
  555.        
  556.         /// <summary>
  557.         /// Construct sequence from the specified array.
  558.         /// </summary>
  559.         public XmlQueryNodeSequence(XPathNavigator[] array, int size) : base(array, size)
  560.         {
  561.         }
  562.        
  563.         /// <summary>
  564.         /// Construct singleton sequence from a single navigator.
  565.         /// </summary>
  566.         public XmlQueryNodeSequence(XPathNavigator navigator) : base(1)
  567.         {
  568.             AddClone(navigator);
  569.         }
  570.        
  571.         /// <summary>
  572.         /// If this property is true, then the nodes in this cache are already in document order with no duplicates.
  573.         /// </summary>
  574.         public bool IsDocOrderDistinct {
  575.             get { return (this.docOrderDistinct == this) || Count <= 1; }
  576.             set {
  577.                 #if DEBUG
  578.                 if (Count > 1) {
  579.                     if (value) {
  580.                         for (int iNav = 0; iNav < Count - 1; iNav++) {
  581.                             XmlNodeOrder cmp = this[iNav].ComparePosition(this[iNav + 1]);
  582.                             Debug.Assert(cmp == XmlNodeOrder.Before || cmp == XmlNodeOrder.Unknown);
  583.                         }
  584.                     }
  585.                 }
  586.                 #endif
  587.                 this.docOrderDistinct = value ? this : null;
  588.             }
  589.         }
  590.        
  591.         /// <summary>
  592.         /// Return a sequence which contains all distinct nodes in this cache, sorted by document order.
  593.         /// </summary>
  594.         public XmlQueryNodeSequence DocOrderDistinct(IComparer<XPathNavigator> comparer)
  595.         {
  596.             int iEach;
  597.             int iDistinct;
  598.             XPathNavigator[] sortArray;
  599.            
  600.             if (this.docOrderDistinct != null)
  601.                 return this.docOrderDistinct;
  602.            
  603.             if (Count <= 1)
  604.                 return this;
  605.            
  606.             // Create a copy of this sequence
  607.             sortArray = new XPathNavigator[Count];
  608.             for (iEach = 0; iEach < sortArray.Length; iEach++)
  609.                 sortArray[iEach] = this[iEach];
  610.            
  611.             // Sort the navigators using a custom IComparer implementation that uses XPathNavigator.ComparePosition
  612.             Array.Sort(sortArray, 0, Count, comparer);
  613.            
  614.             iDistinct = 0;
  615.             for (iEach = 1; iEach < sortArray.Length; iEach++) {
  616.                 if (!sortArray[iDistinct].IsSamePosition(sortArray[iEach])) {
  617.                     // Not a duplicate, so keep it in the cache
  618.                     iDistinct++;
  619.                    
  620.                     if (iDistinct != iEach) {
  621.                         // Fill in "hole" left by duplicate navigators
  622.                         sortArray[iDistinct] = sortArray[iEach];
  623.                     }
  624.                 }
  625.             }
  626.            
  627.             this.docOrderDistinct = new XmlQueryNodeSequence(sortArray, iDistinct + 1);
  628.             this.docOrderDistinct.docOrderDistinct = this.docOrderDistinct;
  629.            
  630.             return this.docOrderDistinct;
  631.         }
  632.        
  633.         /// <summary>
  634.         /// Add a node to the sequence; clone the navigator before doing so.
  635.         /// </summary>
  636.         public void AddClone(XPathNavigator navigator)
  637.         {
  638.             Add(navigator.Clone());
  639.         }
  640.        
  641.         /// <summary>
  642.         /// If any items in the sequence change, then clear docOrderDistinct pointer as well.
  643.         /// </summary>
  644.         protected override void OnItemsChanged()
  645.         {
  646.             this.docOrderDistinct = null;
  647.         }
  648.        
  649.         //-----------------------------------------------
  650.         // IEnumerable<XPathItem> implementation
  651.         //-----------------------------------------------
  652.        
  653.         /// <summary>
  654.         /// Return IEnumerator<XPathItem> implementation.
  655.         /// </summary>
  656.         IEnumerator<XPathItem> IEnumerable<XPathItem>.GetEnumerator()
  657.         {
  658.             return new IListEnumerator<XPathItem>(this);
  659.         }
  660.        
  661.         //-----------------------------------------------
  662.         // ICollection<XPathItem> implementation
  663.         //-----------------------------------------------
  664.        
  665.         /// <summary>
  666.         /// Items may not be added, removed, or modified through the ICollection<T> interface.
  667.         /// </summary>
  668.         bool ICollection<XPathItem>.IsReadOnly {
  669.             get { return true; }
  670.         }
  671.        
  672.         /// <summary>
  673.         /// Items may not be added through the ICollection<T> interface.
  674.         /// </summary>
  675.         void ICollection<XPathItem>.Add(XPathItem value)
  676.         {
  677.             throw new NotSupportedException();
  678.         }
  679.        
  680.         /// <summary>
  681.         /// Items may not be cleared through the ICollection<T> interface.
  682.         /// </summary>
  683.         void ICollection<XPathItem>.Clear()
  684.         {
  685.             throw new NotSupportedException();
  686.         }
  687.        
  688.         /// <summary>
  689.         /// Returns true if the specified value is in the sequence.
  690.         /// </summary>
  691.         bool ICollection<XPathItem>.Contains(XPathItem value)
  692.         {
  693.             return IndexOf((XPathNavigator)value) != -1;
  694.         }
  695.        
  696.         /// <summary>
  697.         /// Copy contents of this sequence to the specified Array, starting at the specified index in the target array.
  698.         /// </summary>
  699.         void ICollection<XPathItem>.CopyTo(XPathItem[] array, int index)
  700.         {
  701.             for (int i = 0; i < Count; i++)
  702.                 array[index + i] = this[i];
  703.         }
  704.        
  705.         /// <summary>
  706.         /// Items may not be removed through the ICollection<T> interface.
  707.         /// </summary>
  708.         bool ICollection<XPathItem>.Remove(XPathItem value)
  709.         {
  710.             throw new NotSupportedException();
  711.         }
  712.        
  713.         //-----------------------------------------------
  714.         // IList<XPathItem> implementation
  715.         //-----------------------------------------------
  716.        
  717.         /// <summary>
  718.         /// Return item at the specified index.
  719.         /// </summary>
  720.         XPathItem IList<XPathItem>.this[int index]
  721.         {
  722.             get {
  723.                 if (index >= Count)
  724.                     throw new ArgumentOutOfRangeException();
  725.                
  726.                 return base[index];
  727.             }
  728.             set {
  729.                 throw new NotSupportedException();
  730.             }
  731.         }
  732.        
  733.         /// <summary>
  734.         /// Returns the index of the specified value in the sequence.
  735.         /// </summary>
  736.         int IList<XPathItem>.IndexOf(XPathItem value)
  737.         {
  738.             return IndexOf((XPathNavigator)value);
  739.         }
  740.        
  741.         /// <summary>
  742.         /// Items may not be added through the IList<T> interface.
  743.         /// </summary>
  744.         void IList<XPathItem>.Insert(int index, XPathItem value)
  745.         {
  746.             throw new NotSupportedException();
  747.         }
  748.        
  749.         /// <summary>
  750.         /// Items may not be removed through the IList<T> interface.
  751.         /// </summary>
  752.         void IList<XPathItem>.RemoveAt(int index)
  753.         {
  754.             throw new NotSupportedException();
  755.         }
  756.     }
  757. }

Developer Fusion