Esempio n. 1
0
        static void Main(string[] args)
        {
            HigherOrderFunctions.DemoHigherOrderFunctions();
            Imperative.DemoImperative();

            Honesty.HonestyDemo();

            OpenJaw.OpenJawDemo("MEL-BKK-KUL", "SIN-LON-NRT-MEL");
            OpenJaw.OpenJawDemo("MEL-BKK-PAR", "SIN-LON-BKK-NRT-MEL");
            OpenJaw.OpenJawDemo("MEL-BKK-SYD");
            OpenJaw.OpenJawDemo("MEL-SIN-BKK-SYD");

            TestAndAdjustData();
            Immutability.AddAndStore(5);
            Immutability.AddAndStore(5);
            Immutability.AddAndStore(5);

            /// What should this print?
            Console.WriteLine("Print Current = {0}", Immutability.accumulated);
        }
Esempio n. 2
0
        public static void HonestyDemo()
        {
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging1(new DateTime(2017, 1, 1)));
            System.Threading.Thread.Sleep(100);

            Console.WriteLine("Age {0}", Honesty.Aging(new DateTime(2017, 1, 1), DateTime.Now));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging(new DateTime(2017, 1, 1), DateTime.Now));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging(new DateTime(2017, 1, 1), DateTime.Now));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging(new DateTime(2017, 1, 1), DateTime.Now));
            System.Threading.Thread.Sleep(100);
            Console.WriteLine("Age {0}", Honesty.Aging(new DateTime(2017, 1, 1), DateTime.Now));
            System.Threading.Thread.Sleep(100);

            Utility.SeqFromTo(10, 0, -1).Select(elem => elem.Reciprocal()).Print("The Reciprocal: ");
            Utility.SeqFromTo(10, 0, -1).Select(elem => elem.Reciprocal2()).Print("The Reciprocal: ");
            Utility.SeqFromTo(10, 0, -1).Select(elem =>
                                                { try { return(elem.Reciprocal3()); } catch { return(default(double)); } }).Print("The Reciprocal: ");
            Utility.SeqFromTo(10, 0, -1).Print("Teest");
            BigInteger x = 100;

            Console.WriteLine(x.Reciprocal());

            /*
             * // To write in Imperative Way
             * for (BigInteger i = 10; i >= 0; i--)
             * {
             *
             *  var result = i.Reciprocal();
             *  var str = string.Format($"{result:0.000000}");
             *  Console.WriteLine($"1/{i} = {result:0.000000}");
             * }
             *
             * for (BigInteger i = 10; i >= 0; i--)
             * {
             *  var result = i.Reciprocal2();
             *  if (result != null)
             *  {
             *      Console.WriteLine($"1/{i} = {result:0.000000}");
             *  }
             * }
             *
             *
             * for (BigInteger i = 10; i >= 0; i--)
             * {
             *  try
             *  {
             *      var result = i.Reciprocal3();
             *      Console.WriteLine($"1/{i} = {result:0.000000}");
             *  }
             *  catch (ArgumentException ex)
             *  {
             *      Console.WriteLine("{0}", ex.Message);
             *  }
             * }
             */
        }