Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
3
Answers
C# : Unable to Refer a Method of a Class using Delegate
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
saravanamurugan m
14y
2k
1
Reply
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
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Lesson 6, Is support for ODBC being discontinued by Microsoft.
how can i related with sensor SUPREMA madule serial port?