using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BismNormalizer.TabularCompare.MultidimensionalMetadata
{
///
/// Represents a collection of Role objects.
///
public class RoleCollection : List
{
///
/// Find an object in the collection by name.
///
///
/// Role object if found. Null if not found.
public Role FindByName(string name)
{
foreach (Role role in this)
{
if (role.Name == name)
{
return role;
}
}
return null;
}
///
/// A Boolean specifying whether the collection contains object by name.
///
///
/// True if the object is found, or False if it's not found.
public bool ContainsName(string name)
{
foreach (Role role in this)
{
if (role.Name == name)
{
return true;
}
}
return false;
}
///
/// Find an object in the collection by Id.
///
///
/// Role object if found. Null if not found.
public Role FindById(string id)
{
foreach (Role role in this)
{
if (role.Id == id)
{
return role;
}
}
return null;
}
///
/// A Boolean specifying whether the collection contains object by Id.
///
///
/// True if the object is found, or False if it's not found.
public bool ContainsId(string id)
{
foreach (Role role in this)
{
if (role.Id == id)
{
return true;
}
}
return false;
}
///
/// Removes an object from the collection by its Id.
///
///
/// True if the object was removed, or False if was not found.
public bool RemoveById(string id)
{
foreach (Role role in this)
{
if (role.Id == id)
{
this.Remove(role);
return true;
}
}
return false;
}
}
}