Do event handlers have to be static?

Supporting Visual Studio on Windows
Post Reply
wamund
Fresh meat
Posts: 1
Joined: Wed Dec 23, 2020 2:34 pm
Contact:

Do event handlers have to be static?

Post by wamund »

In the code examples provided the event handlers are declared as static.
Since I am quite new to C# this proves to be an issue for me, having to reference non-static methods or variables from the event handler method.

So, do event handlers have to be static?

/Mikael
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Do event handlers have to be static?

Post by Patrick »

No they don't need to be static - it's just that the main() function is static in the examples.

-Patrick
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests