Пример #1
0
 public static int Main(string[] args)
 {
     Console.WriteLine("About to run test");
     d = test;
     Test();
     Console.WriteLine("Test complete run test");
     return(100);
 }
Пример #2
0
        public static void Main()
        {
            testDelegate   obj         = new testDelegate();
            sampleDelegate delegateObj = new sampleDelegate(obj.checkEven);

            delegateObj += new sampleDelegate(obj.squareNumber);
            delegateObj(25);


            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            testDelegate td1 = new testDelegate(write);

            td1("Hello Delegate");

            testDelegate td2 = (x) => { Console.WriteLine(x); };

            td2("Hello Anonymous ");

            testDelegate td3 = x => { Console.WriteLine(x); };

            td3("Hello Anonymous  Function");

            lamda();

            Console.ReadLine();
        }
        public async Task <TCPCopyCatController.responseCode> getPacketResponse(int packetAcknowledgeNumber)
        {
            testDelegate qwe = delegate()
            {
                while (dictionaryRegisteredPacket.ContainsKey(packetAcknowledgeNumber))
                {
                    Thread.Sleep(1);
                }
                if (dictionaryRegisteredPacketResponse.ContainsKey(packetAcknowledgeNumber))
                {
                    return(dictionaryRegisteredPacketResponse[packetAcknowledgeNumber]);
                }
                return(TCPCopyCatController.responseCode.NONE);
            };
            Task <TCPCopyCatController.responseCode> task = new Task <TCPCopyCatController.responseCode>(() => qwe());

            task.Start();
            return(await task);
        }
Пример #5
0
        static void Main(string[] args)
        {
            // Original delegate syntax required
            // initialization with a named method.
            testDelegate testdelA = new testDelegate(M);

            // C# 2.0: A delegate can be initialized with
            // inline code, called an "anonymous method."
            testDelegate testDelB = delegate(string s) { Console.WriteLine(s); };

            // C# 3.0. A delegate can be initialized with
            // a lambda expression.
            testDelegate testDelC = (x) => { Console.WriteLine(x); };

            // Invoke the delegates.
            testdelA("Hello. My name is M and I write lines.");
            testDelC("That's nothing. I'm anonymous and ");
            testDelC("I'm a famous author.");

            // Keep console window open in debug mode.
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
Пример #6
0
 public static void Main(string[] args) {
    Program p = new Program();
    testDelegate x = new testDelegate(p.getConcrete);
 }
 public static void Main(string[] args)
 {
     Program      p = new Program();
     testDelegate x = new testDelegate(p.getConcrete);
 }
Пример #8
0
 public static void testMethode(testDelegate variabel)
 {
     Console.WriteLine("Ausgabe des berechneten Integers: " + variabel(5, 3));
 }