Beispiel #1
0
        public void ThreadFunction(object obj)
        {
            foo = CommonClass.FooForDelegate;
            add = CommonClass.AddForDelegate;
            Thread threadFoo = new Thread(new ParameterizedThreadStart(foo));
            Thread threadAdd = new Thread(new ParameterizedThreadStart(add));

            threadFoo.Start(obj);
            threadAdd.Start(obj);
        }
Beispiel #2
0
    public static void Main()
    {
        int i = 1;
        int j = 2;

        AddClass    objAddClass = new AddClass();
        delegateAdd objDelAdd   = new delegateAdd(objAddClass.Add);

        int sum = objDelAdd(i, j);

        Console.WriteLine("Sum of {0},{1} is {2}", i, j, sum);
    }