(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Web / System.Web.UI / ExpressionBindingCollection.cs
blob79cb1ef0ffa7c351671350a8c6c2fd7fa8f0d21c
1 //
2 // System.Web.UI.ExpressionBindingCollection.cs
3 //
4 // Authors:
5 // Sanjay Gupta gsanjay@novell.com)
6 //
7 // (C) 2004 Novell, Inc. (http://www.novell.com)
8 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 //
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 //
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #if NET_2_0
32 using System;
33 using System.Collections;
35 namespace System.Web.UI {
37 public sealed class ExpressionBindingCollection : ICollection, IEnumerable
39 Hashtable list;
40 ArrayList removed;
42 public ExpressionBindingCollection ()
44 list = new Hashtable ();
45 removed = new ArrayList ();
48 public int Count {
49 get { return list.Count; }
52 public bool IsReadOnly {
53 get { return list.IsReadOnly; }
56 public bool IsSynchronized {
57 get { return list.IsSynchronized; }
60 public ExpressionBinding this [string propertyName] {
61 get { return list [propertyName] as ExpressionBinding; }
64 public string [] RemovedBindings {
65 get { return (string []) removed.ToArray (typeof (string)); }
68 public object SyncRoot {
69 get { return list.SyncRoot; }
72 public void Add (ExpressionBinding binding)
74 list.Add (binding.PropertyName, binding);
75 OnChanged (new EventArgs ());
78 public void Clear ()
80 list.Clear ();
81 removed.Clear ();
82 OnChanged (new EventArgs ());
85 public bool Contains (string propertyName)
87 return list.Contains (propertyName);
90 public void CopyTo (Array array, int index)
92 list.CopyTo (array, index);
95 public void CopyTo (ExpressionBinding [] bindings, int index)
97 if (index < 0)
98 throw new ArgumentNullException ("Index cannot be negative");
99 if (index >= bindings.Length)
100 throw new ArgumentException ("Index cannot be greater than or equal to length of array passed");
101 if (list.Count > (bindings.Length - index + 1))
102 throw new ArgumentException ("Number of elements in source is greater than available space from index to end of destination");
104 foreach (string key in list.Keys)
105 bindings [index++] = (ExpressionBinding) list [key];
108 public IEnumerator GetEnumerator ()
110 return list.GetEnumerator ();
113 public void Remove (ExpressionBinding binding)
115 Remove(binding.PropertyName, true);
118 public void Remove (string propertyName)
120 Remove (propertyName, true);
123 public void Remove (string propertyName, bool addToRemovedList)
125 if (addToRemovedList)
126 removed.Add (String.Empty);
127 else
128 removed.Add (propertyName);
130 list.Remove (propertyName);
131 OnChanged (new EventArgs ());
134 public event EventHandler Changed;
136 protected void OnChanged (EventArgs e)
138 if (Changed != null)
139 Changed (this, e);
144 #endif