public void Remove_Element(string MetadataTerm)
{
// Ensure the dictionary is built (i.e., not null)
if (elementsDictionary == null) elementsDictionary = new Dictionary<string, CitationElement>( StringComparer.OrdinalIgnoreCase );
// Check that the count in the dictionary seems right
if (elementsDictionary.Count != Elements.Count)
{
foreach (CitationElement thisElement in Elements)
elementsDictionary[thisElement.MetadataTerm] = thisElement;
}
// If this doesn't exist, do nothin
if (!elementsDictionary.ContainsKey(MetadataTerm))
return;
// Find the match from the dictionary first
CitationElement match = elementsDictionary[MetadataTerm];
Elements.Remove(match);
elementsDictionary.Remove(MetadataTerm);
}