Exemplo n.º 1
0
        private static void SecondWeekExamples()
        {
            AdditionalExamples myAdditional = new AdditionalExamples();

            Console.WriteLine("********");
            Console.WriteLine("UseParms");
            Console.WriteLine("********");
            myAdditional.UseParams(1, 2, 3, 4, 5);
            Console.WriteLine("********");
            Console.WriteLine("GetText");
            Console.WriteLine("********");
            Console.WriteLine(myAdditional.GetText("GetText String"));
            Console.WriteLine("********");
            Console.WriteLine("SomeMethod Without Parameters");
            Console.WriteLine("********");
            myAdditional.SomeMethod();
            Console.WriteLine("********");
            Console.WriteLine("SomeMethod With String Parameters");
            Console.WriteLine("********");
            myAdditional.SomeMethod("Text in Somemethod");
            Console.WriteLine("********");
            Console.WriteLine("SomeMethod With Integer Parameters");
            Console.WriteLine("********");
            Console.WriteLine(myAdditional.SomeMethod(1));
            Console.WriteLine("********");
            Console.WriteLine("Coalescing Example");
            Console.WriteLine("********");
            myAdditional.CoalescingExample();
            Console.WriteLine("********");
            Console.WriteLine("Elvis Operator Example");
            Console.WriteLine("********");
            myAdditional.ElvisOperatorExample();
            Console.WriteLine("********");
            Console.WriteLine("Boolean Example");
            Console.WriteLine("********");
            Console.WriteLine(myAdditional.UseUmbrella(true, true, true));

            NumericTypes myNumericTypes = new NumericTypes();

            Console.WriteLine("********");
            Console.WriteLine("ConvertFloatToInt Example");
            Console.WriteLine("********");
            myNumericTypes.ConvertFloatToInt();
            Console.WriteLine("********");
            Console.WriteLine("LongFromInt Example without Parameters");
            Console.WriteLine("********");
            myNumericTypes.LongFromInt();
            Console.WriteLine("********");
            Console.WriteLine(" LongFromInt Example with Integer Parameter");
            Console.WriteLine("********");
            Console.WriteLine(myNumericTypes.LongFromInt(1));
            Console.WriteLine("********");
            Console.WriteLine(" IncrementDecrement Example");
            Console.WriteLine("********");
            myNumericTypes.IncrementDecrement();
            Console.WriteLine("********");
            Console.WriteLine(" GetSomeTypes Example");
            Console.WriteLine("********");
            myNumericTypes.GetSomeTypes();
            Console.WriteLine("********");
            Console.WriteLine(" BasitMath Example");
            Console.WriteLine("********");
            myNumericTypes.BasicMath();
            Console.WriteLine("********");
            Console.WriteLine(" CheckOperatorType Example");
            Console.WriteLine("********");
            myNumericTypes.CheckOperatorType();
            Console.WriteLine("********");
            Console.WriteLine(" SpecialValues Example");
            Console.WriteLine("********");
            myNumericTypes.SpecialValues();
            Console.WriteLine("********");
            Console.WriteLine(" MyCheckComparison Example");
            Console.WriteLine("********");
            myNumericTypes.MyCheckComparison();
            ReferenceTypes myReference = new ReferenceTypes();

            Console.WriteLine("********");
            Console.WriteLine(" JoiningStrings Example");
            Console.WriteLine("********");
            myReference.JoiningStrings();
            Console.WriteLine("********");
            Console.WriteLine(" JoiningStringsWithBuilder Example");
            Console.WriteLine("********");
            myReference.JoinStringsWithBuilder();
            Console.WriteLine("********");
            Console.WriteLine(" PlaceHolderString Example");
            Console.WriteLine("********");
            myReference.PlaceHolderString();
            Console.WriteLine("********");
            Console.WriteLine(" CompareStrings Example");
            Console.WriteLine("********");
            myReference.CompareStrings();
            Console.WriteLine("********");
            Console.WriteLine(" CharType Example");
            Console.WriteLine("********");
            myReference.CharType();
            Console.WriteLine("********");
            Console.WriteLine(" ArraySingleSample Example");
            Console.WriteLine("********");
            myReference.ArraySingleSample();
            Console.WriteLine("********");
            Console.WriteLine(" ArrayRectanglurSample Example");
            Console.WriteLine("********");
            myReference.ArrayRectanglurSample();
            Console.WriteLine("********");
            Console.WriteLine(" ArrayJaggedSample Example");
            Console.WriteLine("********");
            myReference.ArrayJaggedSample();
            Statements myStatements = new Statements();

            Console.WriteLine("********");
            Console.WriteLine(" Constant Example");
            Console.WriteLine("********");
            myStatements.ConstantExample();
            Console.WriteLine("********");
            Console.WriteLine(" ExpressionStatement Example");
            Console.WriteLine("********");
            myStatements.ExpressionStatementExample(1, 2);
            Console.WriteLine("********");
            Console.WriteLine(" If Statement Basic Example");
            Console.WriteLine("********");
            myStatements.IfStatementBasicExample(1, 2);
            Console.WriteLine("********");
            Console.WriteLine(" If Statement Chain Example");
            Console.WriteLine("********");
            myStatements.IfStatementChainExample("Sunday");
            Console.WriteLine("********");
            Console.WriteLine(" Switch Statement Example");
            Console.WriteLine("********");
            myStatements.SwitchStatemntExample("Monday");
            Console.WriteLine("********");
            Console.WriteLine(" While Loop Example");
            Console.WriteLine("********");
            myStatements.WhileLoopExample();
            Console.WriteLine("********");
            Console.WriteLine(" DoWhile Loop Example");
            Console.WriteLine("********");
            myStatements.DoWhileLoopExample();
            Console.WriteLine("********");
            Console.WriteLine(" For Loop Example");
            Console.WriteLine("********");
            myStatements.ForLoopExample();
            Console.WriteLine("********");
            Console.WriteLine(" For Each Loop Example");
            Console.WriteLine("********");
            myStatements.ForEachLoopExample();
            Console.WriteLine("********");
            Console.WriteLine(" Jump Statement Example");
            Console.WriteLine("********");
            Console.WriteLine(myStatements.JumpStatementExample("Monday"));
            ValueTypesContinues myValueType = new ValueTypesContinues();
            int    x = 3;
            int    y = 4;
            String myTestName, myTestSecondName;

            Console.WriteLine("********");
            Console.WriteLine(" Enum Example");
            Console.WriteLine("********");
            myValueType.EnumSample();
            Console.WriteLine("********");
            Console.WriteLine(" REF Example");
            Console.WriteLine("********");
            Console.WriteLine("The Value before Ref Sample for X is " + x);
            myValueType.RefSample(ref x);
            Console.WriteLine("The Value after Ref Sample for X is " + x);
            Console.WriteLine("********");
            Console.WriteLine(" OUT Example");
            Console.WriteLine("********");
            myValueType.OutSample("Johnny Quest", out myTestName, out myTestSecondName);
            Console.WriteLine("myTestName: " + myTestName + ' ' + myTestSecondName);
            Console.WriteLine(myTestName);
            Console.WriteLine(myTestSecondName);

            // Struct Call
            TestStruct teststruct1 = new TestStruct();
            TestStruct teststruct2 = new TestStruct(10, 10);
        }