Hai Friends,
I am working with Asp.net C#. Here i got a problem with Delegate. I can't able to Refer a method (which is defined in a class) by the class object. Here is my code, Please take a look at it...
Program Code:
using System;
namespace consoleApp {
class baseClass
{
public delegate void delgFun();
public class P
{
public static void Hellow()
{
Console.WriteLine("Hellow World...");
}
public static void Hai()
{
Console.WriteLine("Hai...");
}
}
public static void Main(String[] args)
{
delgFun delgFunObj1 = P.Hellow;
P objP = new P();
delgFun delgFunObj2 = objP.Hai; //here comes problem
delgFunObj1();
delgFunObj2();
}
}
}
Please Fix it.
Advanced thanks
Saraharisan. M