mscorlib(4.0.0.0) API with additions
XmlSchemaObjectCollection.cs
1 using System.Collections;
2 
3 namespace System.Xml.Schema
4 {
7  {
8  private XmlSchemaObject parent;
9 
13  public virtual XmlSchemaObject this[int index]
14  {
15  get
16  {
17  return (XmlSchemaObject)base.List[index];
18  }
19  set
20  {
21  base.List[index] = value;
22  }
23  }
24 
27  {
28  }
29 
33  {
34  this.parent = parent;
35  }
36 
40  {
41  return new XmlSchemaObjectEnumerator(base.InnerList.GetEnumerator());
42  }
43 
51  public int Add(XmlSchemaObject item)
52  {
53  return base.List.Add(item);
54  }
55 
62  public void Insert(int index, XmlSchemaObject item)
63  {
64  base.List.Insert(index, item);
65  }
66 
70  public int IndexOf(XmlSchemaObject item)
71  {
72  return base.List.IndexOf(item);
73  }
74 
79  public bool Contains(XmlSchemaObject item)
80  {
81  return base.List.Contains(item);
82  }
83 
86  public void Remove(XmlSchemaObject item)
87  {
88  base.List.Remove(item);
89  }
90 
102  public void CopyTo(XmlSchemaObject[] array, int index)
103  {
104  base.List.CopyTo(array, index);
105  }
106 
111  protected override void OnInsert(int index, object item)
112  {
113  if (parent != null)
114  {
115  parent.OnAdd(this, item);
116  }
117  }
118 
124  protected override void OnSet(int index, object oldValue, object newValue)
125  {
126  if (parent != null)
127  {
128  parent.OnRemove(this, oldValue);
129  parent.OnAdd(this, newValue);
130  }
131  }
132 
135  protected override void OnClear()
136  {
137  if (parent != null)
138  {
139  parent.OnClear(this);
140  }
141  }
142 
147  protected override void OnRemove(int index, object item)
148  {
149  if (parent != null)
150  {
151  parent.OnRemove(this, item);
152  }
153  }
154 
155  internal XmlSchemaObjectCollection Clone()
156  {
157  XmlSchemaObjectCollection xmlSchemaObjectCollection = new XmlSchemaObjectCollection();
158  xmlSchemaObjectCollection.Add(this);
159  return xmlSchemaObjectCollection;
160  }
161 
162  private void Add(XmlSchemaObjectCollection collToAdd)
163  {
164  base.InnerList.InsertRange(0, collToAdd);
165  }
166  }
167 }
override void OnClear()
OnClear is invoked before the standard Clear behavior. For more information, see OnClear method for T...
Provides the abstract base class for a strongly typed collection.
A collection of T:System.Xml.Schema.XmlSchemaObjects.
Definition: __Canon.cs:3
Represents the root class for the Xml schema object model hierarchy and serves as a base class for cl...
void Remove(XmlSchemaObject item)
Removes an T:System.Xml.Schema.XmlSchemaObject from the XmlSchemaObjectCollection.
override void OnSet(int index, object oldValue, object newValue)
OnSet is invoked before the standard Set behavior. For more information, see the OnSet method for T:S...
bool Contains(XmlSchemaObject item)
Indicates if the specified T:System.Xml.Schema.XmlSchemaObject is in the XmlSchemaObjectCollection.
new XmlSchemaObjectEnumerator GetEnumerator()
Returns an enumerator for iterating through the XmlSchemaObjects contained in the XmlSchemaObjectColl...
void CopyTo(XmlSchemaObject[] array, int index)
Copies all the T:System.Xml.Schema.XmlSchemaObjects from the collection into the given array,...
void Insert(int index, XmlSchemaObject item)
Inserts an T:System.Xml.Schema.XmlSchemaObject to the XmlSchemaObjectCollection.
int Add(XmlSchemaObject item)
Adds an T:System.Xml.Schema.XmlSchemaObject to the XmlSchemaObjectCollection.
override void OnInsert(int index, object item)
OnInsert is invoked before the standard Insert behavior. For more information, see OnInsert method T:...
override void OnRemove(int index, object item)
OnRemove is invoked before the standard Remove behavior. For more information, see the OnRemove metho...
int IndexOf(XmlSchemaObject item)
Gets the collection index corresponding to the specified T:System.Xml.Schema.XmlSchemaObject.
Represents the enumerator for the T:System.Xml.Schema.XmlSchemaObjectCollection.
XmlSchemaObjectCollection(XmlSchemaObject parent)
Initializes a new instance of the XmlSchemaObjectCollection class that takes an T:System....
XmlSchemaObjectCollection()
Initializes a new instance of the XmlSchemaObjectCollection class.