1 /******************************************************************************
3 * Copyright (c) 2003 Novell Inc., www.novell.com
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the Software), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 *******************************************************************************/
25 // System.DirectoryServices.PropertyValueCollection .cs
28 // Sunil Kumar (sunilk@novell.com)
33 using System
.Collections
;
35 namespace System
.DirectoryServices
37 public class PropertyValueCollection
: CollectionBase
41 private DirectoryEntry _parent
;
43 internal PropertyValueCollection(DirectoryEntry parent
):base()
61 public object this[ int index
]
65 return( (object) List
[index
] );
74 public int Add( object value )
83 return( List
.Add( value ) );
88 public void AddRange(object[] values
)
90 foreach (object value in values
)
94 public void AddRange (PropertyValueCollection coll
)
96 foreach (object value in coll
)
100 public int IndexOf( object value )
102 return( List
.IndexOf( value ) );
105 public void Insert( int index
, object value )
107 List
.Insert( index
, value );
111 public void Remove( object value )
113 List
.Remove( value );
117 public bool Contains( object value )
119 return( List
.Contains( value ) );
122 internal bool ContainsCaselessStringValue( string value )
124 for(int i
=0; i
< this.Count
; ++i
)
126 string lVal
= (string) List
[i
];
127 if(String
.Compare(value,lVal
,true)==0)
135 public void CopyTo (object[] copy_to
, int index
)
137 foreach (object o
in List
)
138 copy_to
[index
++] = o
;
142 protected override void OnClearComplete ()
144 if (_parent
!= null) {
145 _parent
.CommitDeferred();
150 protected override void OnInsertComplete (int index
, object value)
152 if (_parent
!= null) {
153 _parent
.CommitDeferred();
158 protected override void OnRemoveComplete (int index
, object value)
160 if (_parent
!= null) {
161 _parent
.CommitDeferred();
166 protected override void OnSetComplete (int index
, object oldValue
, object newValue
)
168 if (_parent
!= null) {
169 _parent
.CommitDeferred();
181 return (object) List
[0];
183 // System.Object[] oArray= new System.Object[this.Count];
184 // object[] oArray= new object[this.Count];
185 // Array.Copy((System.Array)List,0,(System.Array)oArray,0,this.Count);
186 Array LArray
= new object[Count
];
187 for ( int i
= LArray
.GetLowerBound(0); i
<= LArray
.GetUpperBound(0); i
++ )
188 LArray
.SetValue( List
[i
], i
);
194 if (value == null && List
.Count
== 0)