using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BismNormalizer.TabularCompare.TabularMetadata
{
///
/// Represents a collection of Culture objects.
///
public class CultureCollection : List
{
///
/// Find an object in the collection by name.
///
///
/// Culture object if found. Null if not found.
public Culture FindByName(string name)
{
foreach (Culture culture in this)
{
if (culture.Name == name)
{
return culture;
}
}
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 (Culture culture in this)
{
if (culture.Name == name)
{
return true;
}
}
return false;
}
///
/// Find an object in the collection by Id.
///
///
/// Culture object if found. Null if not found.
public Culture FindById(string id)
{
foreach (Culture culture in this)
{
if (culture.InternalName == id)
{
return culture;
}
}
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 (Culture culture in this)
{
if (culture.InternalName == internalName)
{
this.Remove(culture);
return true;
}
}
return false;
}
}
}