Esempio n. 1
0
        static void Main(string[] args)
        {
            //Test test = new Test();
            //test.run();
            ThreadExample threadExample = new ThreadExample();

            threadExample.run();
            Console.ReadKey();
        }
Esempio n. 2
0
    static void Main(string[] args)
    {
        ThreadExample example = new ThreadExample();
        Thread        thread  = new Thread(example.Run);

        Console.WriteLine("Main: Starting thread...");
        thread.Start();
        Console.WriteLine("Press a key to send a pulse");
        Console.ReadKey();
        lock (example)     //locks the object we are using for synchronization
        {
            Console.WriteLine("Sending pulse...");
            Monitor.Pulse(example);     //Sends a pulse to the thread
            Console.WriteLine("Pulse sent.");
        }
        thread.Join();
        Console.ReadKey();
    }
Esempio n. 3
0
 public static void Main(string[] args)
 {
     ThreadExample.RunMultipleThreads();
 }
 static void Main(string[] args)
 {
     ThreadExample ex = new ThreadExample();
     Console.ReadLine();
 }
Esempio n. 5
0
        public static void Main()
        {
            //Tester t = new Tester();
            //t.Run();

            #region yield

            //var integers = TestIterator();

            //var i = TestIterator();
            //Console.WriteLine(i.ToString());
            //Console.WriteLine(TestIterator());
            //Console.WriteLine(TestIterator());
            //Console.WriteLine(TestIterator());

            //Console.WriteLine("foreach");
            //foreach (var integer in integers)
            //{
            //    Console.WriteLine(integer);
            //}
            //foreach (var integer in TestIterator())
            //{
            //    Console.WriteLine(integer);
            //}

            #endregion yield

            #region Boxing/Unboxing

            //Point p = new Point();
            //p.x = 1;
            //Object o = p;
            //p.x = 2;
            //Console.WriteLine(((Point)o).x.ToString());

            #endregion Boxing/Unboxing

            #region lambda

            //Account account = new Account(100);
            //account.Added += (sender, e) =>
            //{
            //    Console.WriteLine($"Сумма транзакции: {e.Sum}");
            //    Console.WriteLine(e.Message);
            //};
            //account.Withdrawn += (sender, e) =>
            //{
            //    Console.WriteLine(e.Message);          };

            //account.Put(200);
            //account.Put(109);
            //account.Withdraw(500);

            //VariableScopeWithLambdas.Execute();

            //1-10
            //VariableLambdaCapture.vc();

            //10-10
            //VariableLambdaCapture.vcRange();
            #endregion lambda

            #region event

            //EventMain.EventMainExecute();

            #endregion event

            //StructTest.Exec();

            //BoxingUnboxing.BoxingUnboxingTest();

            //CompareString.Compare();

            //LockTest.Test();
            //LockTestTreads.Test();

            //NewOverride.Test();

            //StaticTest.Test();

            #region Exception

            //MyCustomExceptionTest.Test();
            //IndexOutOfRangeExceptionBase.Test();
            //ExceptionC.TestException();

            #endregion Exception



            //Action a1 = () => Console.Write(1); Action a2 = () => Console.Write(2); Action a3 = () => Console.Write(3);
            //((a1 + a2 + a3) - (a1 + a2))();
            //((a1 + a2 + a3) - (a1 + a3))();

            ThreadExample.ThreadMain();

            Console.ReadKey();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            ThreadExample threadExample = new ThreadExample(10000);

            threadExample.Start();
        }