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.SearchResultCollection.cs
28 // Sunil Kumar (sunilk@novell.com)
34 using System.Collections;
36 namespace System.DirectoryServices
39 /// Contains the SearchResult instances that the Active Directory
40 /// hierarchy returned during a DirectorySearcher query.
43 /// Each time you perform a query, DirectorySearcher creates a handle to
44 /// the corresponding SearchResultCollection instance. This handle
45 /// persists until you call Dispose or until garbage collection picks up
48 public class SearchResultCollection : MarshalByRefObject, ICollection, IEnumerable, IDisposable
50 protected ArrayList sValues = new ArrayList();
53 internal SearchResultCollection()
59 get{return sValues.Count;}
62 bool ICollection.IsSynchronized
64 get{return sValues.IsSynchronized;}
67 object ICollection.SyncRoot
69 get{return sValues.SyncRoot;}
72 void ICollection.CopyTo(System.Array oArray, int iArrayIndex)
74 sValues.CopyTo(oArray, iArrayIndex);
77 public void CopyTo(SearchResult[] results, int index)
79 ((ICollection) this).CopyTo((System.Array)results,index);
82 internal void Add(object oValue)
87 public bool IsFixedSize
89 get{return m_oKeys.IsFixedSize;}
92 public bool IsReadOnly
94 get{return m_oKeys.IsReadOnly;}
97 public ICollection Keys
99 get{return m_oValues.Keys;}
108 public bool Contains(object oKey)
110 return m_oValues.Contains(oKey);
113 public bool ContainsKey(object oKey)
115 return m_oValues.ContainsKey(oKey);
118 public IDictionaryEnumerator GetEnumerator()
120 return m_oValues.GetEnumerator();
123 public void Remove(object oKey)
125 m_oValues.Remove(oKey);
126 m_oKeys.Remove(oKey);
129 public object this[object oKey]
131 get{return m_oValues[oKey];}
132 set{m_oValues[oKey] = value;}
135 bool Contains(object oValues)
137 return sValues.Contains(oValues);
140 public bool Contains(SearchResult result)
142 return Contains(result);
145 public SearchResult this[int index]
147 get{return (SearchResult)sValues[index];}
150 /* public ICollection Values
152 get{return m_oValues.Values;}
155 public int IndexOf (SearchResult result)
157 return sValues.IndexOf(result);
160 public IEnumerator GetEnumerator()
162 return sValues.GetEnumerator();
165 public void Dispose ()
169 public string[] PropertiesLoaded
172 get { throw new NotImplementedException (); }
178 get { throw new NotImplementedException (); }