示例#1
0
        static void intTest()
        {
            var array = new ListOfArrayList <int>(4);

            array.Add(1);
            array.Add(3);
            array.Add(6);
            array.Add(2);

            array.Add(8);
            array.Add(0);
            array.Add(4);
            array.Add(7);

            array.Add(1);
            WriteLine("Aktualna tablica: ");
            WriteLine(array);
            WriteLine("Metoda Remove(3)");
            array.Remove(3);
            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda Trim()");
            array.Trim();
            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda array[7]: ");
            WriteLine(array[7]);

            WriteLine("Metoda Clear()");
            array.Clear();
            WriteLine("Aktualna tablica: ");
            WriteLine(array);
        }
示例#2
0
        static void mixedNumberTest()
        {
            var array = new ListOfArrayList <MixedNumber>(3);

            MixedNumber myNumber = new MixedNumber(5.25);

            array.Add(myNumber);
            array.Add(new MixedNumber(43, 23));
            array.Add(new MixedNumber(10.25));
            array.Add(new MixedNumber(81, 2));

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda RemoveAt(2)");
            array.RemoveAt(2);

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda IndexOf(myNumber)");
            WriteLine(array.IndexOf(myNumber));

            WriteLine("Metoda Contains(myNumber)");
            WriteLine(array.Contains(myNumber));

            WriteLine("Metoda Trim()");
            array.Trim();

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda Remove(myNumber)");
            array.Remove(myNumber);

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Count");
            WriteLine(array.Count);

            WriteLine("Metoda Clear()");
            array.Clear();

            WriteLine("Aktualna tablica: ");
            WriteLine(array);
        }
示例#3
0
        static void studentTest()
        {
            var array = new ListOfArrayList <Student>(1);

            Student ja = new Student("Kamil", "Graczyk", 246994, "*****@*****.**");

            array.Add(ja);
            array.Add(new Student("Jan", "Nowak", 249874, "*****@*****.**"));
            array.Add(new Student("Zigniew", "Kowalski", 247896, "*****@*****.**"));

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda RemoveAt(2)");
            array.RemoveAt(2);

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda IndexOf(new Student(\"Kamil\", \"Graczyk\", 246994, \"[email protected]\"))");
            WriteLine(array.IndexOf(new Student("Kamil", "Graczyk", 246994, "*****@*****.**")));

            WriteLine("Metoda Contains(new Student(\"Kamil\", \"Graczyk\", 246994, \"[email protected]\"))");
            WriteLine(array.Contains(new Student("Kamil", "Graczyk", 246994, "*****@*****.**")));

            WriteLine("Metoda Trim()");
            array.Trim();

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Metoda Remove(ja)");
            array.Remove(ja);

            WriteLine("Aktualna tablica: ");
            WriteLine(array);

            WriteLine("Count");
            WriteLine(array.Count);

            WriteLine("Metoda Clear()");
            array.Clear();

            WriteLine("Aktualna tablica: ");
            WriteLine(array);
        }