예제 #1
0
        static void Main(string[] args)
        {
            var run = true;

            var ann = new Person("Ann");
            var davidH = new Person("DavidH");
            var charlie = new Person("Charlie");
            var emily = new Person("Emily");
            var davidK = new Person("DavidK");
            var kelly = new Person("Kelly");
            var dan = new Person("Dan");

            ann.SignificantOther = davidH;
            davidH.SignificantOther = ann;
            charlie.SignificantOther = emily;
            emily.SignificantOther = charlie;
            davidK.SignificantOther = kelly;
            kelly.SignificantOther = davidK;

            var personList = new List<Person> {ann, davidH, davidK, charlie, emily, kelly, dan};
            var pickedList = new List<Person> {ann, davidH, davidK, charlie, emily, kelly, dan};

            while (run)
            {
                Console.WriteLine("");
                Run(personList, pickedList);
                PrintResults(personList);
                Console.WriteLine();
                Console.WriteLine("Again? Y/N");
                var input = Console.ReadKey();

                if (input.Key.ToString().Equals("N"))
                {
                    run = false;
                }
                else
                {
                    pickedList = new List<Person> { ann, davidH, davidK, charlie, emily, kelly, dan };
                }
            }
        }
예제 #2
0
 public bool IsInARelationshipWith(Person person)
 {
     return person.Equals(SignificantOther);
 }