Page 1 of 1

Do event handlers have to be static?

Posted: Wed Dec 23, 2020 2:51 pm
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

Re: Do event handlers have to be static?

Posted: Mon Jan 04, 2021 11:27 am
by Patrick
No they don't need to be static - it's just that the main() function is static in the examples.

-Patrick