示例#1
0
        static void Main(string[] args)
        {
            PersonHashCode PHC = new PersonHashCode();


            Person alex  = new Person("Olexandr", "Bohuslavskyi", 27);
            Person olex  = new Person("Olexandr", "Bohuslavskyi", 29);
            Person Ken   = new Person("Ken", "Block", 38);
            Person ass   = new Person("Ken", "Block", 38);
            Person Homer = new Person("Homer", "Simpson", 64);

            PHC.Add(alex);
            PHC.Add(olex);
            PHC.Add(Ken);
            PHC.Add(ass);
            PHC.Add(Homer);



            Console.WriteLine(Homer.GetHashCode());
            Console.WriteLine(alex.GetHashCode());
            Console.WriteLine(olex.GetHashCode());
            Console.WriteLine(Ken.GetHashCode());
            Console.WriteLine(ass.GetHashCode());
            Console.WriteLine(PHC.Size());
            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            PersonHashCode PHC = new PersonHashCode();
            

            Person alex = new Person("Olexandr", "Bohuslavskyi", 27);
            Person olex = new Person("Olexandr", "Bohuslavskyi", 29);
            Person Ken = new Person("Ken", "Block", 38);
            Person ass = new Person("Ken", "Block", 38);
            Person Homer = new Person("Homer", "Simpson", 64);

            PHC.Add(alex);
            PHC.Add(olex);
            PHC.Add(Ken);
            PHC.Add(ass);
            PHC.Add(Homer);



            Console.WriteLine(Homer.GetHashCode());
            Console.WriteLine(alex.GetHashCode());
            Console.WriteLine(olex.GetHashCode());
            Console.WriteLine(Ken.GetHashCode());
            Console.WriteLine(ass.GetHashCode());
            Console.WriteLine(PHC.Size());
            Console.ReadLine();
        }
示例#3
0
        public void AddInHashTable(string[] fNames,string[] lNames,int[] ages)
        {
            PersonHashCode phc = new PersonHashCode();
            int[] hashes = new int[fNames.Length];
            for (int i = 0; i < fNames.Length; i++)
            {
                phc.Add(new Person(fNames[i], lNames[i], ages[i]));
            }
            

        }