
22 Delegates
22.2 Delegate instantiation
Paragraph 11 An instance of a delegate is created by a delegate-creation-expression (§14.5.10.3). 2 The newly created delegate instance then refers to either:
delegate void D(int x);
class Test
{
public static void M1(int i) {...}
public void M2(int i) {...}
}
class Demo
{
static void Main() {
D cd1 = new D(Test.M1); // static method
Test t = new Test();
D cd2 = new D(t.M2); // instance method
D cd3 = new D(cd2); // another delegate
}
}
end example]
| |
| Jagger Software Ltd | |
| Company # 4070126 | |
| VAT # 762 5213 42 |