Exemplo n.º 1
0
        private static void LambdaSample()
        {
            LambdaExamples myLamb = new LambdaExamples();

            myLamb.MyLambdaOne(myLamb.MyLambdaOne(5));

            LambdaExamples mySecond = new LambdaExamples(23);

            Console.WriteLine(mySecond.MyLambdaOne(mySecond.MyValue));
        }
Exemplo n.º 2
0
        private static void LambdaSample()
        {
            LambdaExamples myLAmbda = new LambdaExamples();

            Console.WriteLine(myLAmbda.MyLambdaOne(5));
            Console.WriteLine(myLAmbda.MyLambdaOne(6));
            Console.WriteLine(myLAmbda.MyLambdaOne(7));
            Console.WriteLine(myLAmbda.MyLambdaOne(8));
            Console.WriteLine(myLAmbda.MyLambdaOne(9));
            Console.WriteLine(myLAmbda.MyLambdaOne(10));
        }
Exemplo n.º 3
0
        public delegate void TryOn(string Type);  //won't work in main

        public static void RunWeek4Classwork()
        {
            DelegateSample();

            EventSample();

            LambdaSample();

            void LambdaSample()
            {
                LambdaExamples myLamb = new LambdaExamples();

                //myLamb.MyLambdaOne(5);
                Console.WriteLine(myLamb.MyLambdaOne(5));


                LambdaExamples mySecond = new LambdaExamples(23);

                Console.WriteLine(mySecond.MyLambdaOne(mySecond.MyValue));
            }

            void DelegateSample()
            {
                Hats  myHat  = new Hats("Cowboy", 7); //old stuff
                TryOn theHat = myHat.TryOnHat;

                theHat("I tried on a " + myHat.HatType + " hat was size " + myHat.HatSize);

                Hats mySecond = new Hats();
            }

            void EventSample()
            {
                Coats  myCoat = new Coats();      //Instantiate the class
                string result = myCoat.MyResult;  //Get results from the property

                Console.WriteLine(result);
            }
        }
Exemplo n.º 4
0
        private static void LambdaSample()
        {
            LambdaExamples myLamb = new LambdaExamples();

            Console.WriteLine(myLamb.MyLambdaOne(5));
        }