Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.PublicDataMembers:
                    PublicDataMembersExample();
                    break;

                case Items.UsingAProperty:
                    UsingAPropertyExample();
                    break;

                case Items.CreatingAccessorMethods:
                    CreatingAccessorMethodsExample();
                    break;

                case Items.ProtectedAccess:
                    ProtectedAccessExample();
                    break;

                case Items.PrintingInterface:
                    PrintingInterfaceExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.BoxingAndUnboxing:
                    BoxingAndUnboxingExample();
                    break;

                case Items.TypeConversion:
                    TypeConversionExample();
                    break;

                case Items.BadDynamicCode:
                    BadDynamicCodeExample();
                    break;

                case Items.UsingDynamicVariables:
                    UsingDynamicVariablesExample();
                    break;

                case Items.InteractingWithExcel:
                    InteractingWithExcelExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.GarbageCollection:
                    GarbageCollectionExample();
                    break;

                case Items.FinalizerMethod:
                    FinalizerMethodExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.IPrintableInterface:
                    IPrintableInterfaceExample();
                    break;

                case Items.IAccountInterface:
                    IAccountInterfaceExample();
                    break;

                case Items.BabyAccount:
                    BabyAccountExample();
                    break;

                case Items.OverridenWithdrawFunds:
                    OverridenWithdrawFundsExample();
                    break;

                case Items.BaseMethod:
                    BaseMethodExample();
                    break;

                case Items.BankAccountConstructor:
                    BankAccountConstructorExample();
                    break;

                case Items.ComparingBankAccounts:
                    ComparingBankAccountsExample();
                    break;

                case Items.TypedIComparable:
                    TypedIComparableExample();
                    break;

                case Items.GetAnEnumerator:
                    GetAnEnumeratorExample();
                    break;

                case Items.UsingForeach:
                    UsingForeachExample();
                    break;

                case Items.CreatingAnEnumerableType:
                    CreatingAnEnumerableTypeExample();
                    break;

                case Items.UsingYield:
                    UsingYieldExample();
                    break;

                case Items.UsingIDisposable:
                    UsingIDisposableExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;
                CleanVariables();

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.SingleTaskSumming:
                    SingleTaskSummingExample();
                    break;

                case Items.BadTaskInteraction:
                    BadTaskInteractionExample();
                    break;

                case Items.UsingLocking:
                    UsingLockingExample();
                    break;

                case Items.SensibleLocking:
                    SensibleLockingExample();
                    break;

                case Items.UsingMonitors:
                    UsingMonitorsExample();
                    break;

                case Items.SequentialLocking:
                    SequentialLockingExample();
                    break;

                case Items.DeadlockedTasks:
                    DeadlockedTasksExample();
                    break;

                case Items.InterlockTotal:
                    InterlockTotalExample();
                    break;

                case Items.CancelATask:
                    CancelATaskExample();
                    break;

                case Items.CancelWithException:
                    CancelWithExceptionExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.PublishAndSubscribe:
                    PublishAndSubscribeExample();
                    break;

                case Items.Unsubscribing:
                    UnsubscribingExample();
                    break;

                case Items.EventBasedAlarm:
                    EventBasedAlarmExample();
                    break;

                case Items.EventHandlerAlarm:
                    EventHandlerAlarmExample();
                    break;

                case Items.EventHandlerData:
                    EventHandlerDataExample();
                    break;

                case Items.AggregateExceptions:
                    AggregateExceptionsExample();
                    break;

                case Items.CreateDelegates:
                    CreateDelegatesExample();
                    break;

                case Items.LambdaExpressions:
                    LambdaExpressionsExample();
                    break;

                case Items.Closures:
                    ClosuresExample();
                    break;

                case Items.BuiltInDelegates:
                    BuiltInDelegatesExample();
                    break;

                case Items.LambdaExpressionTask:
                    LambdaExpressionTaskExample();
                    Thread.Sleep(3000);
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.ParallelInvoke:
                    ParallelInvokeExample();
                    break;

                case Items.ParallelForEach:
                    ParallelForEachExample();
                    break;

                case Items.ParallelFor:
                    ParallelForExample();
                    break;

                case Items.ManagingParallelForLoop:
                    ManagingParallelForLoopExample();
                    break;

                case Items.ParallelLINQ:
                    ParallelLINQExample();
                    break;

                case Items.InformingParallelization:
                    InformingParallelizationExample();
                    break;

                case Items.UsingAsOrdered:
                    UsingAsOrderedExample();
                    break;

                case Items.UsingAsSequential:
                    UsingAsSequentialExample();
                    break;

                case Items.UsingForAll:
                    UsingForAllExample();
                    break;

                case Items.ExceptionsInPLINQ:
                    ExceptionsInPLINQExample();
                    break;

                case Items.CreateATask:
                    CreateATaskExample();
                    break;

                case Items.RunATask:
                    RunATaskExample();
                    break;

                case Items.TaskReturningAValue:
                    TaskReturningAValueExample();
                    break;

                case Items.TaskWaitAll:
                    TaskWaitAllExample();
                    break;

                case Items.ContinuationTasks:
                    ContinuationTasksExample();
                    break;

                case Items.ContinuationOptions:
                    ContinuationOptionsExample();
                    break;

                case Items.AttachedChildTasks:
                    AttachedChildTasksExample();
                    break;

                case Items.CreatingThreads:
                    CreatingThreadsExample();
                    break;

                case Items.UsingThreadStart:
                    UsingThreadStartExample();
                    break;

                case Items.ThreadAndLambdaExpressions:
                    ThreadAndLambdaExpressionsExample();
                    break;

                case Items.ParameterizedThreadStart:
                    ParameterizedThreadStartExample();
                    break;

                case Items.ThreadLambdaParameters:
                    ThreadLambdaParametersExample();
                    break;

                case Items.AbortingAThread:
                    AbortingAThreadExample();
                    break;

                case Items.AbortingAThreadWithASharedFlagVariable:
                    AbortingAThreadWithASharedFlagVariableExample();
                    break;

                case Items.ThreadSynchronizationUsingJoin:
                    ThreadSynchronizationUsingJoinExample();
                    break;

                case Items.ThreadLocal:
                    ThreadLocalExample();
                    break;

                case Items.ThreadContext:
                    ThreadContextExample();
                    break;

                case Items.ThreadPool:
                    ThreadPoolExample();
                    break;

                case Items.UsingBlockingCollection:
                    UsingBlockingCollectionExample();
                    break;

                case Items.BlockConcurrentStack:
                    BlockConcurrentStackExample();
                    break;

                case Items.ConcurrentQueue:
                    ConcurrentQueueExample();
                    break;

                case Items.ConcurrentStack:
                    ConcurrentStackExample();
                    break;

                case Items.ConcurrentBag:
                    ConcurrentBagExample();
                    break;

                case Items.ConcurrentDictionary:
                    ConcurrentDictionaryExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    /* Se o exemplo for relacionado com Thread, espero 1 seg antes de exibir a mensagem final.
                     * Caso contrário o sistema printa a mensagem final antes da mensagem do exemplo */
                    if (Convert.ToInt32(item) > 17)
                    {
                        Thread.Sleep(1000);
                    }

                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.WhileLoops:
                    WhileLoopsExample();
                    break;

                case Items.DoWhileLoops:
                    DoWhileLoopsExample();
                    break;

                case Items.ForLoops:
                    ForLoopsExample();
                    break;

                case Items.IterateWithFor:
                    IterateWithForExample();
                    break;

                case Items.IterateWithForeach:
                    IterateWithForeachExample();
                    break;

                case Items.UppercasePerson:
                    UppercasePersonExample();
                    break;

                case Items.UsingBreak:
                    UsingBreakExample();
                    break;

                case Items.UsingContinue:
                    UsingContinueExample();
                    break;

                case Items.IfConstruction:
                    IfConstructionExample();
                    break;

                case Items.LogicalExpressions:
                    LogicalExpressionsExample();
                    break;

                case Items.SwitchConstruction:
                    SwitchConstructionExample();
                    break;

                case Items.SwitchingOnStrings:
                    SwitchingOnStringsExample();
                    break;

                case Items.ExpressionEvaluation:
                    ExpressionEvaluationExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.ConditionalAttribute:
                    ConditionalAttributeExample();
                    break;

                case Items.TestingForAnAttribute:
                    TestingForAnAttributeExample();
                    break;

                case Items.ReadAnAttribute:
                    ReadAnAttributeExample();
                    break;

                case Items.GetTypeMethod:
                    GetTypeMethodExample();
                    break;

                case Items.InvestingatingAType:
                    InvestingatingATypeExample();
                    break;

                case Items.ReflectionMethodCall:
                    ReflectionMethodCallExample();
                    break;

                case Items.FindingComponents:
                    FindingComponentsExample();
                    break;

                case Items.LINQComponents:
                    LINQComponentsExample();
                    break;

                case Items.CodeDOMObject:
                    CodeDOMObjectExample();
                    break;

                case Items.LambdaExpressionTree:
                    LambdaExpressionTreeExample();
                    break;

                case Items.ModifyingAnExpressionTree:
                    ModifyingAnExpressionTreeExample();
                    break;

                case Items.AssemblyObject:
                    AssemblyObjectExample();
                    break;

                case Items.PropertyInfo:
                    PropertyInfoExample();
                    break;

                case Items.MethodReflection:
                    MethodReflectionExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.ValueAndReferenceTypes:
                    ValueAndReferenceTypesExample();
                    break;

                case Items.CreatingAStructure:
                    CreatingAStructureExample();
                    break;

                case Items.CreatingAnEnum:
                    CreatingAnEnumExample();
                    break;

                case Items.CreatingAReference:
                    CreatingAReferenceExample();
                    break;

                case Items.UsingGenericTypes:
                    UsingGenericTypesExample();
                    break;

                case Items.Constructors:
                    ConstructorsExample();
                    break;

                case Items.OverloadedConstructors:
                    OverloadedConstructorsExample();
                    break;

                case Items.CallingConstructors:
                    CallingConstructorsExample();
                    break;

                case Items.StaticConstructors:
                    StaticConstructorsExample();
                    break;

                case Items.StaticVariables:
                    StaticVariablesExample();
                    break;

                case Items.SimpleMethod:
                    SimpleMethodExample();
                    break;

                case Items.ExtensionMethods:
                    ExtensionMethodsExample();
                    break;

                case Items.NamedParameters:
                    NamedParametersExample();
                    break;

                case Items.OptionalParameters:
                    OptionalParametersExample();
                    break;

                case Items.IndexedProperties:
                    IndexedPropertiesExample();
                    break;

                case Items.IndexingOnStrings:
                    IndexingOnStringsExample();
                    break;

                case Items.OverloadedDateTimeConstructor:
                    OverloadedDateTimeConstructorExample();
                    break;

                case Items.MethodOverriding:
                    MethodOverridingExample();
                    break;

                case Items.UsingBase:
                    UsingBaseExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }
Ejemplo n.º 11
0
        static void Main(string[] args)
        {
            bool run = true;

            while (run)
            {
                Items item = Items.None;

                int i = ConsoleFunctions.ShowMenuOptions <Items>();

                if (i == 99)
                {
                    item = Items.Sair;
                }
                else
                {
                    item = (Items)Enum.Parse(typeof(Items), i.ToString());
                }

                switch (item)
                {
                case Items.TryCatch:
                    TryCatchExample();
                    break;

                case Items.ExceptionObject:
                    ExceptionObjectExample();
                    break;

                case Items.ExceptionsTypes:
                    ExceptionsTypesExample();
                    break;

                case Items.FinallyBlock:
                    FinallyBlockExample();
                    break;

                case Items.ThrowingException:
                    ThrowingExceptionExample();
                    break;

                case Items.RethrowingException:
                    RethrowingExceptionExample();
                    break;

                case Items.InnerException:
                    InnerExceptionExample();
                    break;

                case Items.CustomExceptions:
                    CustomExceptionsExample();
                    break;

                case Items.ConditionalClauses:
                    ConditionalClausesExample();
                    break;

                case Items.HandlingInnerExceptions:
                    HandlingInnerExceptionsExample();
                    break;

                case Items.AggregateExceptions:
                    AggregateExceptionsExample();
                    break;

                case Items.Sair:
                    run = false;
                    break;
                }

                if (run)
                {
                    Console.WriteLine("Finished processing. Press a key to end.");
                    Console.ReadKey();
                }
            }
        }