Here is a simple example of passing a delegate to a function.
class DelegateTest
{
private delegate void MyDelegate();
public static void Main(string[] args)
{
MyDelegate d = new MyDelegate(Test);
CallDelegate(d);
}
private static void CallDelegate(MyDelegate d)
{
d(); // call the delegate that was passed in
}
private static void Test()
{
Console.WriteLine("Hello, world!");
}
}
P.
--
www.CL4.org