http://msdn.microsoft.com/en-us/library/ms173171%28v=vs.90%29.aspx
http://msdn.microsoft.com/en-us/library/System.Delegate_methods.aspx
-----------------------------------------------------------------------------------
using System;
delegate void MyDelegate(int X, int y); //Declaring new delegate type
public static void MethodA()
{
MyDelegate process = new ProcessNums(AddNums); //Instantiating with AddNums method.
process(3, 5); //The output should be 8
}
static void AddNums(int x, int y) //The method is enclosed in the delegate(MyDelegate)
{
Console.WriteLine(x + y);
}
No comments:
Post a Comment