using System;
delegate void FunctionToCall();
class MyClass
{
public void nonStaticMethod()
{
Console.WriteLine("nonStaticMethod");
}
public static void staticMethod()
{
Console.WriteLine("staticMethod");
}
}
class MainClass
{
static void Main()
{
MyClass t = new MyClass();
FunctionToCall functionDelegate;
functionDelegate = t.nonStaticMethod;
functionDelegate += MyClass.staticMethod;
functionDelegate += t.nonStaticMethod;
functionDelegate += MyClass.staticMethod;
functionDelegate();
}
}
|