TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
pelledoca
NA
9
0
Why Invoke() works on .NET framework delegates and not on my own????
Oct 25 2004 11:29 AM
Why doesn't this code compile??? Why can I call Invoke on .NET Framework defined delegates and not on my own. using System; namespace DelegatesTest { public delegate void MyDelegate(); ///
/// Summary description for MyClass. ///
class MyClass { public System.Threading.TimerCallback timerCallback = null; public System.Timers.ElapsedEventHandler elapsedEventHandler = null; public DelegatesTest.MyDelegate myDelegate = null; ///
/// The main entry point for the application. ///
[STAThread] static void Main(string[] args) { MyClass myClass = new MyClass(); // OK myClass.timerCallback.Invoke(null); // OK myClass.elapsedEventHandler.Invoke(null, null); // NOT OK - will not compile myClass.myDelegate.Invoke(); } } } Don't look at the fact that the 3 delegates are not assigned any valid method ... I tried writing the shortest possible example to explain my problem. Bob
Reply
Answers (
2
)
Call Graph
C# .net console application, leadtools problem on XP