I have a class A, B
class A
{
public class B
{
public event EventHandler handleClick;
public void eventraising(object sender, EventArgs e)
{
if (handleClick != null)
handleClick(this, e);
}
}
//handle raised event here
}
How can I do this
Class A would need an instance of B somewhere first. Nesting classes in .NET is simply a way of organizing the types. It doesn’t imply any kind of ownership of an instance.
So you’d have to do something like:
Also, your event should just be called Click, not handleClick.