Switch to compiler-tester
[mono.git] / mcs / class / System.Web / System.Web.Security / MembershipUserCollection.cs
1 //
2 // System.Web.Security.MembershipUserCollection
3 //
4 // Authors:
5 //      Ben Maurer (bmaurer@users.sourceforge.net)
6 //
7 // (C) 2003 Ben Maurer
8 //
9
10 //
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.
29 //
30
31 #if NET_2_0
32 using System.Collections;
33 using System.Web.UI;
34 using System;
35
36 namespace System.Web.Security
37 {
38         [Serializable]
39         public class MembershipUserCollection : ICollection
40         {
41                 public MembershipUserCollection ()
42                 {
43                 }
44                 
45                 public void Add (MembershipUser user)
46                 {
47                         CheckNotReadOnly ();
48                         store.Add (user.UserName, user);
49                 }
50                 
51                 public void Clear ()
52                 {
53                         CheckNotReadOnly ();
54                         store.Clear ();
55                 }
56                 
57                 void ICollection.CopyTo (Array array, int index)
58                 {
59                         store.CopyTo (array, index);
60                 }
61                 
62                 public void CopyTo (MembershipUser[] array, int index)
63                 {
64                         store.CopyTo (array, index);
65                 }
66                 
67                 public IEnumerator GetEnumerator ()
68                 {
69                         return ((IEnumerable) store).GetEnumerator ();
70                 }
71                 
72                 public void Remove (string name)
73                 {
74                         CheckNotReadOnly ();
75                         store.Remove (name);
76                 }
77                 
78                 public void SetReadOnly ()
79                 {
80                         readOnly = true;
81                 }
82                 
83                 public int Count {
84                         get { return store.Count; }
85                 }
86                 
87                 public bool IsSynchronized {
88                         get { return false; }
89                 }
90                 
91                 public MembershipUser this [string name] {
92                         get { return (MembershipUser) store [name]; }
93                 }
94                 
95                 public object SyncRoot {
96                         get { return this; }
97                 }
98                 
99                 void CheckNotReadOnly ()
100                 {
101                         if (readOnly)
102                                 throw new InvalidOperationException ();
103                 }
104                 
105                 KeyedList store = new KeyedList ();
106                 bool readOnly = false;
107         }
108 }
109 #endif
110