Beispiel #1
0
        private static void TestIndexOf <T>(GenericList <T> list, T value) where T : IComparable <T>
        {
            ConsoleMio
            .Format("Looking up index of {0}: ", color: Info, args: value)
            .WriteLine(list.IndexOf(value), color: Result)
            .WriteLine();

            PrintList(list);
            ConsoleMio.PromptToContinue(color: Pause);
        }
        private static void PrintResult(Shape shape)
        {
            ConsoleMio
            .Write("Surface = ", Info)
            .FormatLine("{0:F}", Result, shape.CalculateSurface());

            ConsoleMio.PromptToContinue(Warning);
        }
        private static void Reset()
        {
            ConsoleMio.WriteLine();
            ConsoleMio.PromptToContinue(Info);
            Console.Clear();

            ConsoleMio.PrintHeading("Extension Methods Tests");
            ConsoleMio.WriteLine("What would you like to test: ", Info);
        }
Beispiel #4
0
        private static void PrintPeople(IEnumerable <Human> people)
        {
            bool odd = true;

            foreach (var human in people)
            {
                ConsoleMio
                .WriteLine(human, odd ? Result : Info);

                odd = !odd;
            }

            ConsoleMio.WriteLine();
            ConsoleMio.PromptToContinue(Info);
        }
        private static void Main()
        {
            ConsoleMio.PrintHeading("OOP Principles - Part 1 - Animals");

            var animals = GenerateAnimals();

            PrintAnimals(animals);

            var averageAges = GetAverageAges(animals);

            ConsoleMio.PromptToContinue(Info);
            ConsoleMio.WriteLine("Average Ages:", Info)
            .WriteLine(Dash, Info);

            foreach (var key in averageAges.Keys)
            {
                ConsoleMio.Write(key, Result)
                .Write(" average age: ", Info)
                .FormatLine("{0:F}", Result, averageAges[key]);
            }

            ConsoleMio.WriteLine(Dash, Info)
            .WriteLine();
        }