dotnetN00b dotnetN00b - 1 year ago 84 Question

Does C# have a Handles keyword?

Protected Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick

End Sub

In, we have the Handles keyword, I'm wondering if C# has anything comparable. Or do you have to manually wire all the methods to each control's event (in ASP.NET especially)?

Answer Source

Nope. You will have to wire up the event like this

Menu1.MenuItemClick += Menu1_MenuItemClick;