Welcome to mirror list, hosted at ThFree Co, Russian Federation.

DataBindingCollection.cs « System.Web.UI « System.Web « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 80e86454612c7e7a1575583d8bb5c7338e64f969 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// System.Web.UI.DataBindingCollection.cs
//
// Duncan Mak  (duncan@ximian.com)
//
// (C) Ximian, Inc.
//

using System;
using System.Collections;

namespace System.Web.UI {

	public sealed class DataBindingCollection : ICollection, IEnumerable
	{
		Hashtable list;
		ArrayList removed;
		
		public DataBindingCollection ()
		{
			list = new Hashtable ();
			removed = new ArrayList ();
		}

		public int Count {
			get { return list.Count; }
		}

		public bool IsReadOnly {
			get { return list.IsReadOnly; }
		}

		public bool IsSynchronized {
			get { return list.IsSynchronized; }
		}

		public DataBinding this [string propertyName] {
			get { return list [propertyName] as DataBinding; }
		}

		public string [] RemovedBindings {
			get { return (string []) removed.ToArray (typeof (string)); }
		}

		public object SyncRoot {
			get { return list.SyncRoot; }
		}

		public void Add (DataBinding binding)
		{
			list.Add (binding.PropertyName, binding);
		}

		public void Clear ()
		{
			list.Clear ();
		}

		public void CopyTo (Array array, int index)
		{
			list.CopyTo (array, index);
		}

		public IEnumerator GetEnumerator ()
		{
			return list.GetEnumerator ();
		}

		public void Remove (DataBinding binding)
		{
			string key = binding.PropertyName;
			Remove (key);
		}

		public void Remove (string propertyName)
		{
			removed.Add (propertyName);
			list.Remove (propertyName);
		}

		public void Remove (string propertyName,
				    bool addToRemovedList)
		{
			if (addToRemovedList)
				removed.Add (String.Empty); // LAMESPEC
			else
				removed.Add (propertyName);

			list.Remove (propertyName);
		}
	}
}