Ejemplo n.º 1
0
        static void Lesson11()
        {
            Lesson11 mylesson11 = new Lesson11();

            mylesson11.SampleLesson11();
            mylesson11.UseParams2(10, 3, 36, 45, 120);
            int[] intArray = { 2, 3, 4, 5, 6 };
            mylesson11.UseParams(intArray);
            mylesson11.UseParams2(1, "Happy", false, 34.5F);
            mylesson11.OptionalParam("Alex");
            mylesson11.OptionalParam("Alex", 19);
            int test = 14;

            mylesson11.RefSample(ref test);
            //String myTestName, myTestSecondName;

            mylesson11.OutSample("John Doe Riley", out string myTestName, out string myTestSecondName, out string middle);

            // Console.WriteLine(myTestName);
            Console.WriteLine(myTestName + ", " + myTestSecondName);
            Console.WriteLine(middle);

            // Output - myTestName = John & mySecondName = Doe

            // mylesson11.OutSample("John Doe", out string first, out string second);
            //Console.WriteLine(first);
            //  Console.WriteLine(second);
        }
Ejemplo n.º 2
0
        static void ParamSample()
        {
            Lesson11 lesson = new Lesson11();

            lesson.UseParams(10, 3, 24, 36, 45, 120);

            lesson.UseParams();

            int[] intArray = { 2, 3, 4, 5, 6 };
            lesson.UseParams(intArray);

            lesson.UseParams2(1, "happy", false, 34.5F);

            lesson.OptionalParam("Roger");
            lesson.OptionalParam("Matthew", 19);
        }
Ejemplo n.º 3
0
        static void ParamsSample()
        {
            Lesson11 lesson = new Lesson11();

            lesson.Useparams(10, 3, 24, 36, 45, 120);

            lesson.Useparams(); //accepts 0 and more agruments, just creates a line when prints

            int[] intArray = { 2, 3, 4, 5, 6 };
            lesson.Useparams(intArray);

            lesson.Useparams2(1, "Happy", false, 34.5F);

            lesson.OptionalParam("Tom");
            lesson.OptionalParam("Ted", 19);
        }