示例#1
0
 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);
 }
示例#2
0
 public void Remove(ClassMammals mammal)
 {
     AnimalValue.Remove(mammal.BaseAnimal);
     StringValue.Remove(mammal.BaseAnimal.ToString());
     AnimalKeyMammalValue.Remove(mammal.BaseAnimal);
     StringKeyMammalValue.Remove(mammal.BaseAnimal.ToString());
 }
示例#3
0
        public void ContainsValue(ClassMammals mammal)
        {
            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();

            bool contains = AnimalKeyMammalValue.ContainsValue(mammal);

            stopWatch.Stop();
            OutputTime(stopWatch);
        }
示例#4
0
        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);
        }