W
Water Cooler v2
Am I right in guessing that there is no direct C# equivalant for the
'WithEvents' VB keyword. The substitute is to add event handlers to the
delegate instances that are the public members of the class.
For instance,
Public WithEvents ObjFoo As New ClassFoo
Public Sub ObjFoo_FooDone(ByVal sender as Object, ByVal e As EventArgs)
Console.WriteLine("Foo has been done.")
End Sub
public ClassFoo ObjFoo;
public void Init()
{
ObjFoo = new ClassFoo();
ObjFoo.FooDone += new TheClassOfWhichFooDoneIsAType(fooDone);
}
public void fooDone(Object s, EventArgs e)
{
Console.WriteLine("Foo has been done.");
}
'WithEvents' VB keyword. The substitute is to add event handlers to the
delegate instances that are the public members of the class.
For instance,
Public WithEvents ObjFoo As New ClassFoo
Public Sub ObjFoo_FooDone(ByVal sender as Object, ByVal e As EventArgs)
Console.WriteLine("Foo has been done.")
End Sub
public ClassFoo ObjFoo;
public void Init()
{
ObjFoo = new ClassFoo();
ObjFoo.FooDone += new TheClassOfWhichFooDoneIsAType(fooDone);
}
public void fooDone(Object s, EventArgs e)
{
Console.WriteLine("Foo has been done.");
}