Contact Form

Name

Email *

Message *

Friday, 10 January 2014

testing code post

1:  using System;  
2:  using System.Collections.Generic;  
3:  using System.Linq;  
4:  using System.Text;  
5:  using System.Threading.Tasks;  
6:  namespace Delegate_Test_2  
7:  {  
8:    class Program  
9:    {  
10:      delegate int MyDelegateType(int p);  
11:      static void Main(string[] args)  
12:      {  
13:        MyDelegateType myDel = func1;  
14:        myDel += func2;  
15:        myDel += func3;  
16:        //Only The Returned from the Last Funtion is returned...  
17:        Console.WriteLine("\n Returned value from myDel = "+myDel(2));  
18:        Console.ReadKey();  
19:      }  
20:      public static int func1(int p)  
21:      {  
22:        Console.WriteLine("\n func1 got " + p + " and returning " + 71);  
23:        return (71);  
24:      }  
25:      public static int func2(int p)  
26:      {  
27:        Console.WriteLine("\n func2 got " + p + " and returning " + 81);  
28:        return (81);  
29:      }  
30:      public static int func3(int p)  
31:      {  
32:        Console.WriteLine("\n func3 got " + p + " and returning " + 91);  
33:        return (91);  
34:      }  
35:    }  
36:  }  

No comments:

Post a Comment

Write something...