예제 #1
0
파일: Program.cs 프로젝트: K1516/DEMO6
        static void Main(string[] args)
        {
            // create an object from Persons
            Persons myNiggas = new Persons();

            // create a n****s...
            Person nigga1 = new Person { FName = "Jalmari", LName = "Kasapaskaa", Sotu = "010101-01E6"};
            Person nigga2 = new Person { FName = "Peppi", LName = "Heinämies", Sotu = "020202-02C8" };
            Person nigga3 = new Person { FName = "Dickhead", LName = "Rääväsuu", Sotu = "030303-1234" };
            Person nigga4 = new Person { FName = "Poor", LName = "Juustopää", Sotu = "040404-5678" };

            // add persons to collection
            myNiggas.AddPerson(nigga1);
            myNiggas.AddPerson(nigga2);
            myNiggas.AddPerson(nigga3);
            myNiggas.AddPerson(nigga4);

            // Print collection

            myNiggas.PrintCollection();

            // get one person
            Console.WriteLine("Get one person from collection");
            Person nigga5 = myNiggas.GetPerson(1);
            if (nigga5 != null)
            {
                Console.WriteLine(nigga5.ToString());

            }
            else
            {
                Console.WriteLine("Cannot find n***a in that position, must be too dark.");
            }

            // find person with sotu
            string sotu = "010101-11E6";
            Console.WriteLine("Find person with sotu: " + sotu);
            Person nigga6 = myNiggas.FindPerson(sotu);
            if (nigga6 != null)
            {
                Console.WriteLine(nigga6.ToString());
            }else
            {
                Console.WriteLine("Not found n***a that u looking for...");
            }
        }
예제 #2
0
파일: Persons.cs 프로젝트: K1516/DEMO6
 /// <summary>
 /// Adds a person to collection
 /// </summary>
 /// <param name="person">Added person</param>
 public void AddPerson(Person person)
 {
     persons.Add(person);
 }