The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.Qil \ QilIterator

  1. //------------------------------------------------------------------------------
  2. // <copyright file="QilIterator.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.Diagnostics;
  17. namespace System.Xml.Xsl.Qil
  18. {
  19.    
  20.     /// <summary>
  21.     /// View over a Qil iterator node (For or Let).
  22.     /// </summary>
  23.     internal class QilIterator : QilReference
  24.     {
  25.         private QilNode binding;
  26.        
  27.         //-----------------------------------------------
  28.         // Constructor
  29.         //-----------------------------------------------
  30.        
  31.         /// <summary>
  32.         /// Construct an iterator
  33.         /// </summary>
  34.         public QilIterator(QilNodeType nodeType, QilNode binding) : base(nodeType)
  35.         {
  36.             Binding = binding;
  37.         }
  38.        
  39.        
  40.         //-----------------------------------------------
  41.         // IList<QilNode> methods -- override
  42.         //-----------------------------------------------
  43.        
  44.         public override int Count {
  45.             get { return 1; }
  46.         }
  47.        
  48.         public override QilNode this[int index]
  49.         {
  50.             get {
  51.                 if (index != 0)
  52.                     throw new IndexOutOfRangeException();
  53.                 return this.binding;
  54.             }
  55.             set {
  56.                 if (index != 0)
  57.                     throw new IndexOutOfRangeException();
  58.                 this.binding = value;
  59.             }
  60.         }
  61.        
  62.        
  63.         //-----------------------------------------------
  64.         // QilIterator methods
  65.         //-----------------------------------------------
  66.        
  67.         /// <summary>
  68.         /// Expression which is bound to the iterator.
  69.         /// </summary>
  70.         public QilNode Binding {
  71.             get { return this.binding; }
  72.             set { this.binding = value; }
  73.         }
  74.     }
  75. }

Developer Fusion