Exemple #1
0
        static void Main(string[] args)
        {
            SortedList T = new SortedList();

            T.Add("F", new Empoyee("LA5693", "Alami", "walid", DateTime.Parse("19/07/1974"), 7500));
            Empoyee E = new Empoyee("LA658", "Khamlichi", "Ahmed", DateTime.Parse("19/08/1999"), 12000);

            T.Add("B", E);
            T.Add("f", "Salut");
            T.Add("C", new Empoyee("K569897", "Bakali", "Mourad", DateTime.Parse("25/09/2008"), 14000));

            T.Add("A", 66);
            //ArrayList S = ArrayList.Repeat(E, 20);
            //IEnumerator X = T.GetEnumerator();
            //while (X.MoveNext()) Console.WriteLine(X.Current.ToString());
            //Console.WriteLine(T.Count);
            foreach (Object p in T.Keys)
            {
                Console.WriteLine(T[p]);
            }
            Console.WriteLine("----------------");
            for (int i = 0; i < T.Count; i++)
            {
                Console.WriteLine(T.get(i));
            }



            Console.ReadKey();
        }
Exemple #2
0
        public int CompareTo(object obj)
        {
            Empoyee E        = (Empoyee)obj;
            int     resultat = this.Nom.CompareTo(E.Nom);

            if (resultat == 0)
            {
                resultat = this.Prénom.CompareTo(E.Prénom);
                if (resultat == 0)
                {
                    resultat = this.DateNaissance.CompareTo(E.DateNaissance);
                }
            }

            return(resultat);
        }