using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; namespace BismNormalizer.TabularCompare.TabularMetadata { /// /// Represents a collection of Perspective objects. /// public class PerspectiveCollection : List { /// /// Find an object in the collection by name. /// /// /// Perspective object if found. Null if not found. public Perspective FindByName(string name) { foreach (Perspective perspective in this) { if (perspective.Name == name) { return perspective; } } 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 (Perspective perspective in this) { if (perspective.Name == name) { return true; } } return false; } /// /// Find an object in the collection by Id. /// /// /// Culture object if found. Null if not found. public Perspective FindById(string id) { foreach (Perspective perspective in this) { if (perspective.InternalName == id) { return perspective; } } return null; } /// /// Removes an object from the collection by its internal name. /// /// /// True if the object was removed, or False if was not found. public bool Remove(string internalName) { foreach (Perspective perspective in this) { if (perspective.InternalName == internalName) { this.Remove(perspective); return true; } } return false; } } }