using System; using System.Collections.Generic; namespace BismNormalizer.TabularCompare { /// /// Represents a collection of ProcessingTable objects. /// public class ProcessingTableCollection : List { /// /// Find an object in the collection by name. /// /// /// ProcessingTable object if found. Null if not found. public ProcessingTable FindByName(string name) { foreach (ProcessingTable table in this) { if (table.Name == name) { return table; } } return null; } /// /// Find an object in the collection by Id. /// /// /// ProcessingTable object if found. Null if not found. public ProcessingTable FindById(string id) { foreach (ProcessingTable table in this) { if (table.Id == id) { return table; } } return null; } /// /// A Boolean specifying whether the collection contains object by name. /// /// /// True if an object of that name is found, or False if it's not found. public bool ContainsName(string name) { foreach (ProcessingTable table in this) { if (table.Name == name) { return true; } } return false; } /// /// A Boolean specifying whether the collection contains object by Id. /// /// /// True if an object of that name is found, or False if it's not found. public bool ContainsId(string id) { foreach (ProcessingTable table in this) { if (table.Id == id) { return true; } } return false; } } }