Exemplo n.º 1
0
        public bool Replace(int index, Magazine magazine)
        {
            var res = MagazineReplaced;

            if (index < 0 || index >= _magazines.Count)
            {
                return(false);
            }
            _magazines[index] = magazine;
            res?.Invoke(this, new MagazineListHandlerEventArgs(CollectionName, "Replaced", index));
            return(true);
        }
Exemplo n.º 2
0
        public Dictionary <string, int> GetTime(Magazine search)
        {
            var  time      = new Dictionary <string, int>();
            int  n         = edition.Count;
            long startTime = DateTime.UtcNow.Ticks;

            edition.Contains(search.EditionValues);
            time.Add("edition", (int)(DateTime.UtcNow.Ticks - startTime));

            startTime = DateTime.UtcNow.Ticks;
            strEdition.Contains(search.EditionValues.ToString());
            time.Add("strEdition", (int)(DateTime.UtcNow.Ticks - startTime));

            startTime = DateTime.UtcNow.Ticks;
            editionAndMagazine.ContainsKey(search.EditionValues);
            time.Add("E&M_Key", (int)(DateTime.UtcNow.Ticks - startTime));

            startTime = DateTime.UtcNow.Ticks;
            strMagazine.ContainsKey(search.EditionValues.ToString());
            time.Add("str&M_Key", (int)(DateTime.UtcNow.Ticks - startTime));

            startTime = DateTime.UtcNow.Ticks;
            editionAndMagazine.ContainsValue(search);
            time.Add("E&M_Value", (int)(DateTime.UtcNow.Ticks - startTime));

            startTime = DateTime.UtcNow.Ticks;
            strMagazine.ContainsValue(search);
            time.Add("str&M_Value", (int)(DateTime.UtcNow.Ticks - startTime));
            if (strMagazine.ContainsKey(search.EditionValues.ToString()))
            {
                Console.WriteLine("Exist");
            }
            else
            {
                Console.WriteLine("Such Magazine not found");
            }
            return(time);
        }