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] );
73 public int Add( object value )
82 return( List.Add( value ) );
87 public void AddRange(object[] values)
89 foreach (object value in values)
93 public void AddRange (PropertyValueCollection coll)
95 foreach (object value in coll)
99 public int IndexOf( object value )
101 return( List.IndexOf( value ) );
104 public void Insert( int index, object value )
106 List.Insert( index, value );
109 public void Remove( object value )
111 List.Remove( value );
114 public bool Contains( object value )
116 return( List.Contains( value ) );
119 internal bool ContainsCaselessStringValue( string value )
121 for(int i=0; i< this.Count; ++i)
123 string lVal = (string) List[i];
124 if(String.Compare(value,lVal,true)==0)
132 public void CopyTo (object[] copy_to, int index)
134 foreach (object o in List)
135 copy_to[index++] = o;
139 protected override void OnClearComplete ()
141 if (_parent != null) {
142 _parent.CommitDeferred();
147 protected override void OnInsertComplete (int index, object value)
149 if (_parent != null) {
150 _parent.CommitDeferred();
155 protected override void OnRemoveComplete (int index, object value)
157 if (_parent != null) {
158 _parent.CommitDeferred();
163 protected override void OnSetComplete (int index, object oldValue, object newValue)
165 if (_parent != null) {
166 _parent.CommitDeferred();
178 return (object) List[0];
180 // System.Object[] oArray= new System.Object[this.Count];
181 // object[] oArray= new object[this.Count];
182 // Array.Copy((System.Array)List,0,(System.Array)oArray,0,this.Count);
183 Array LArray = new object[Count];
184 for ( int i = LArray.GetLowerBound(0); i <= LArray.GetUpperBound(0); i++ )
185 LArray.SetValue( List[i], i );