public void Add(ClassMammals mammal) { AnimalValue.Add(mammal.BaseAnimal); StringValue.Add(mammal.BaseAnimal.ToString()); AnimalKeyMammalValue.Add(mammal.BaseAnimal, mammal); StringKeyMammalValue.Add(mammal.BaseAnimal.ToString(), mammal); }
public void Remove(ClassMammals mammal) { AnimalValue.Remove(mammal.BaseAnimal); StringValue.Remove(mammal.BaseAnimal.ToString()); AnimalKeyMammalValue.Remove(mammal.BaseAnimal); StringKeyMammalValue.Remove(mammal.BaseAnimal.ToString()); }
public void ContainsValue(ClassMammals mammal) { Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); bool contains = AnimalKeyMammalValue.ContainsValue(mammal); stopWatch.Stop(); OutputTime(stopWatch); }
private int GetIndex(ClassMammals mammal) { string key = ""; foreach (var el in StringKeyMammalValue) { if (el.Value == mammal) { key = el.Key; } } int i = 0; foreach (string el in StringValue) { if (el == key) { return(i); } i++; } return(-1); }