using System;
using System.Collections;
namespace ActiveDirectory_Demo1.GlobalObjects.AuthorityObjects
{
/// <summary>
/// Summary description for GroupCollection.
/// </summary>
public class GroupCollection : CollectionBase
{
/// <summary>
/// Enumerator for this collection.
/// </summary>
public virtual Group this[int index]
{
get
{
return (Group) this.List[index];
}
set
{
this.List[index] = value;
}
}
/// <summary>
/// Returns the index (position) of an item in the collection.
/// </summary>
/// <param name="item">Item to be searched.</param>
/// <returns>Returns the index(position) of the item.</returns>
public virtual int IndexOf(Group item)
{
return this.List.IndexOf(item);
}
/// <summary>
/// This method appends an item to the collection.
/// </summary>
/// <param name="item">Item to be appended to the collection.</param>
/// <returns>Returns an integer indicating if the item was added.</returns>
public virtual int Add(Group item)
{
if(!this.List.Contains(item))
{this.List.Add(item);}
return this.List.Count-1;
}
public virtual bool Contains(string groupname)
{
bool rtn = false;
foreach(Group group in this)
{
if(group.GroupName == groupname)
{
rtn = true;break;
}
}
return rtn;
}
}
}