To add instance method from a type(class) we have to reference the instance type name.
using System;
delegate void Printer(int i);
class MyClass
{
public void consolePrinter(int i)
{
Console.WriteLine(i);
}
}
class Test
{
static void Main()
{
MyClass cls = new MyClass();
Printer p = cls.consolePrinter;
}
}
| w___w_w.j_a__v___a__2_s___.___co__m_ | Contact Us |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |