The Labs \ Source Viewer \ SSCLI \ System.Xml.Schema \ XmlSchemaObjectCollection

  1. //------------------------------------------------------------------------------
  2. // <copyright file="XmlSchemaObjectCollection.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. // <owner current="true" primary="true">priyal</owner>
  15. //------------------------------------------------------------------------------
  16. namespace System.Xml.Schema
  17. {
  18.    
  19.     using System.Collections;
  20.     using System.ComponentModel;
  21.     using System.Xml.Serialization;
  22.    
  23.     /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection"]/*' />
  24.     /// <devdoc>
  25.     /// <para>[To be supplied.]</para>
  26.     /// </devdoc>
  27.     public class XmlSchemaObjectCollection : CollectionBase
  28.     {
  29.         XmlSchemaObject parent;
  30.        
  31.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.XmlSchemaObjectCollection"]/*' />
  32.         /// <devdoc>
  33.         /// <para>[To be supplied.]</para>
  34.         /// </devdoc>
  35.         public XmlSchemaObjectCollection()
  36.         {
  37.         }
  38.        
  39.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.XmlSchemaObjectCollection1"]/*' />
  40.         /// <devdoc>
  41.         /// <para>[To be supplied.]</para>
  42.         /// </devdoc>
  43.         public XmlSchemaObjectCollection(XmlSchemaObject parent)
  44.         {
  45.             this.parent = parent;
  46.         }
  47.        
  48.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.this"]/*' />
  49.         /// <devdoc>
  50.         /// <para>[To be supplied.]</para>
  51.         /// </devdoc>
  52.         public virtual XmlSchemaObject this[int index]
  53.         {
  54.             get { return (XmlSchemaObject)List[index]; }
  55.             set { List[index] = value; }
  56.         }
  57.        
  58.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.GetEnumerator"]/*' />
  59.         /// <devdoc>
  60.         /// <para>[To be supplied.]</para>
  61.         /// </devdoc>
  62.         public new XmlSchemaObjectEnumerator GetEnumerator()
  63.         {
  64.             return new XmlSchemaObjectEnumerator(InnerList.GetEnumerator());
  65.         }
  66.        
  67.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.Add"]/*' />
  68.         /// <devdoc>
  69.         /// <para>[To be supplied.]</para>
  70.         /// </devdoc>
  71.         public int Add(XmlSchemaObject item)
  72.         {
  73.             return List.Add(item);
  74.         }
  75.        
  76.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.Insert"]/*' />
  77.         /// <devdoc>
  78.         /// <para>[To be supplied.]</para>
  79.         /// </devdoc>
  80.         public void Insert(int index, XmlSchemaObject item)
  81.         {
  82.             List.Insert(index, item);
  83.         }
  84.        
  85.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.IndexOf"]/*' />
  86.         /// <devdoc>
  87.         /// <para>[To be supplied.]</para>
  88.         /// </devdoc>
  89.         public int IndexOf(XmlSchemaObject item)
  90.         {
  91.             return List.IndexOf(item);
  92.         }
  93.        
  94.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.Contains"]/*' />
  95.         /// <devdoc>
  96.         /// <para>[To be supplied.]</para>
  97.         /// </devdoc>
  98.         public bool Contains(XmlSchemaObject item)
  99.         {
  100.             return List.Contains(item);
  101.         }
  102.        
  103.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.Remove"]/*' />
  104.         /// <devdoc>
  105.         /// <para>[To be supplied.]</para>
  106.         /// </devdoc>
  107.         public void Remove(XmlSchemaObject item)
  108.         {
  109.             List.Remove(item);
  110.         }
  111.        
  112.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.CopyTo"]/*' />
  113.         /// <devdoc>
  114.         /// <para>[To be supplied.]</para>
  115.         /// </devdoc>
  116.         public void CopyTo(XmlSchemaObject[] array, int index)
  117.         {
  118.             List.CopyTo(array, index);
  119.         }
  120.        
  121.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.OnInsert"]/*' />
  122.         /// <devdoc>
  123.         /// <para>[To be supplied.]</para>
  124.         /// </devdoc>
  125.         protected override void OnInsert(int index, object item)
  126.         {
  127.             if (parent != null) {
  128.                 parent.OnAdd(this, item);
  129.             }
  130.         }
  131.        
  132.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.OnSet"]/*' />
  133.         /// <devdoc>
  134.         /// <para>[To be supplied.]</para>
  135.         /// </devdoc>
  136.         protected override void OnSet(int index, object oldValue, object newValue)
  137.         {
  138.             if (parent != null) {
  139.                 parent.OnRemove(this, oldValue);
  140.                 parent.OnAdd(this, newValue);
  141.             }
  142.         }
  143.        
  144.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.OnClear"]/*' />
  145.         /// <devdoc>
  146.         /// <para>[To be supplied.]</para>
  147.         /// </devdoc>
  148.         protected override void OnClear()
  149.         {
  150.             if (parent != null) {
  151.                 parent.OnClear(this);
  152.             }
  153.         }
  154.        
  155.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectCollection.OnRemove"]/*' />
  156.         /// <devdoc>
  157.         /// <para>[To be supplied.]</para>
  158.         /// </devdoc>
  159.         protected override void OnRemove(int index, object item)
  160.         {
  161.             if (parent != null) {
  162.                 parent.OnRemove(this, item);
  163.             }
  164.         }
  165.        
  166.         internal XmlSchemaObjectCollection Clone()
  167.         {
  168.             XmlSchemaObjectCollection coll = new XmlSchemaObjectCollection();
  169.             coll.Add(this);
  170.             return coll;
  171.         }
  172.        
  173.         private void Add(XmlSchemaObjectCollection collToAdd)
  174.         {
  175.             this.InnerList.InsertRange(0, collToAdd);
  176.         }
  177.     }
  178.    
  179.     /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator"]/*' />
  180.     /// <devdoc>
  181.     /// <para>[To be supplied.]</para>
  182.     /// </devdoc>
  183.     public class XmlSchemaObjectEnumerator : IEnumerator
  184.     {
  185.         IEnumerator enumerator;
  186.        
  187.         internal XmlSchemaObjectEnumerator(IEnumerator enumerator)
  188.         {
  189.             this.enumerator = enumerator;
  190.         }
  191.        
  192.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.Reset"]/*' />
  193.         /// <devdoc>
  194.         /// <para>[To be supplied.]</para>
  195.         /// </devdoc>
  196.         public void Reset()
  197.         {
  198.             enumerator.Reset();
  199.         }
  200.        
  201.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.MoveNext"]/*' />
  202.         /// <devdoc>
  203.         /// <para>[To be supplied.]</para>
  204.         /// </devdoc>
  205.         public bool MoveNext()
  206.         {
  207.             return enumerator.MoveNext();
  208.         }
  209.        
  210.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.Current"]/*' />
  211.         /// <devdoc>
  212.         /// <para>[To be supplied.]</para>
  213.         /// </devdoc>
  214.         public XmlSchemaObject Current {
  215.             get { return (XmlSchemaObject)enumerator.Current; }
  216.         }
  217.        
  218.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.IEnumerator.Reset"]/*' />
  219.         /// <internalonly/>
  220.         void IEnumerator.Reset()
  221.         {
  222.             enumerator.Reset();
  223.         }
  224.        
  225.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.IEnumerator.MoveNext"]/*' />
  226.         /// <internalonly/>
  227.         bool IEnumerator.MoveNext()
  228.         {
  229.             return enumerator.MoveNext();
  230.         }
  231.        
  232.         /// <include file='doc\XmlSchemaObjectCollection.uex' path='docs/doc[@for="XmlSchemaObjectEnumerator.IEnumerator.Current"]/*' />
  233.         /// <internalonly/>
  234.         object IEnumerator.Current {
  235.             get { return enumerator.Current; }
  236.         }
  237.     }
  238.    
  239. }

Developer Fusion