Reputation: 35
I have 2 projects. In the first:
public delegate _Event(int code);
public event _Event TestEvent;
now I want to do something like this in my second project
public void TestFunc()
{
TestEvent(11); //Project1.MyClass.TestEvent(11);
}
namely I want to fire Project1's event form Project2. Can anybody help me about this?
Upvotes: 0
Views: 619
Reputation: 7192
1.You're missing the return type on the delegate.
2.You can fire the event from within the declaring type only. What you can do is declare a public method on the type which declares the event which fires it.
public delegate void _Event(int code);
public event _Event TestEvent;
public void FireEvent(int val){TestEvent(val);}
Upvotes: 1