Exemple #1
0
        public static void Main(string[] args)
        {
            CarDemo demo = new CarDemo();

            demo.ShowDemo();
        }
Exemple #2
0
        static int Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Console.ForegroundColor = ConsoleColor.Green;
            Console.Title           = "Playgound Pro C# .Net Core API";
            string[] theArgs = Environment.GetCommandLineArgs();
            foreach (string arg in theArgs)
            {
                Console.WriteLine("Arg: {0}", arg);
            }

            ShowEnvironmentDetails();
            ShowNumberFormat();
            ShowDefaultDeclarations();
            TryFromStringWithTryParse();
            Playground playground = new Playground();

            playground.LinqQueryOverInts();
            playground.JaggedMultiDimensionalArrays();

            playground.CalculateAverage(out double average, 4.0, 3.0, 5.0);

            Console.WriteLine(@"Average {0}", average);

            Playground.Days currDay = Playground.Days.Monday;
            playground.GreetOnDay(currDay);

            Rectangle <int> newRect = new Rectangle <int>(@"Original Rectangle Info", 1, 2);

            Console.WriteLine(@"Original Rect Message");
            newRect.Message();
            Rectangle <int> copyRect = newRect;

            copyRect.rectInfo.InfoString = @"Modified Rectangle Info";
            Console.WriteLine(@"Copy Rect Message");
            copyRect.Message();
            Console.WriteLine(@"Original Rect Message post modification");
            newRect.Message();

            Console.WriteLine(@"Tuple members");
            Tuples tuples = new Tuples();

            tuples.PlayWithTuples();

            Console.WriteLine(@"Split Members");
            Tuples splitNames = new Tuples();

            var(first, _, last) = splitNames.SplitNames("Vaibhav Ramesh Panchal");
            Console.WriteLine($"{first} {last}");

            Point <double> deconstructedTuple = new Point <double>(30.0f, 40.0f);

            var(xPos, yPos, color) = deconstructedTuple.Deconstruct();
            Console.WriteLine($"xPos : {xPos}, yPos : {yPos}, color : {color}");


            // Exception DemoInteface
            try
            {
                HarleyDavidson harleyDavidson = new HarleyDavidson("harley", 1, "HR1001");
                for (int i = 0; i < 5000; i++)
                {
                    harleyDavidson.SpeedUpBy(i);
                }
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("===Speed Exception===");
                Console.WriteLine(e.Message);
                Console.WriteLine(e.TargetSite);
                Console.WriteLine(e.StackTrace);
                Console.WriteLine("===Speed Exception===");
                Console.ForegroundColor = ConsoleColor.White;
            }


            // Interface
            //ShapesDemo.DemoInteface();
            ShapesDemo.DemoExplicitInterface();

            //EnumDemo.Demo();
            //EnumDemo.DemoCustomerEnumerator();
            EnumDemo.DemoYield();
            EmployeeDemo.DemoSortedSet();

            Calculator <int> .CalculatorDemo();

            CarDemo carDemo = new CarDemo();

            carDemo.DemoEvents();


            NumberDemo.LamdaDemo();

            PersonCollection.PersonCollectionDemo();

            RectangleFloat.CastDemo();
            Console.ReadKey();



            return(0);
        }