/// <summary>
/// Collection of users.
/// </summary>
[Serializable()]
public class Users : ArrayList
{
#region Public Properties
/// <summary>
/// Returns a specific user.
/// </summary>
public new User this[int index]
{
get
{
return ((User)base[index]);
}
}
#endregion
#region Public Methods
/// <summary>
/// Add a user to the collection
/// </summary>
/// <param name="user">The user to be added.</param>
/// <returns>Index of the added user.</returns>
public int Add(User user)
{
return base.Add(user);
}
/// <summary>
/// Object version of the typed 'Add' method.
/// Do not use.
/// </summary>
/// <param name="value">Ignored.</param>
/// <returns>Always throws an exception</returns>
public override int Add(object value)
{
throw new Exception("Please call the typed overload");
}
/// <summary>
/// Insert the user at a given index.
/// </summary>
/// <param name="index">Index location to insert the user.</param>
/// <param name="user">The user to be added.</param>
public void Insert(int index, User user)
{
base.Insert(index, user);
}
/// <summary>
/// Object version (weak typed) of the 'Insert' method.
/// Do not use.
/// Exception will be thrown always.
/// </summary>
/// <param name="index">Ignored</param>
/// <param name="value">Ignored</param>
public override void Insert(int index, object value)
{
throw new Exception("Please call the typed overload (Insert(int, User))");
}
/// <summary>
/// Remove a user from the documemt.
/// </summary>
/// <param name="user">Reference of the user to remove.</param>
public void Remove(User user)
{
base.Remove(user);
}
/// <summary>
/// Check if the collection contains the user specified.
/// </summary>
/// <param name="user">The user to look for in the collection.</param>
/// <returns>True/False if the user exists in the list.</returns>
public bool Contains(User user)
{
return base.Contains(user);
}
#endregion
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment