Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the event keyword really do?

Tags:

c#

events

public delegate void SecondChangedHandler(
        object clock, 
        TimeInfoEventArgs timeInformation);

    public event SecondChangedHandler SecondChanged;

I have written a clock based on this article. Now if i remove the event keyword i get the same result, so what does event really do?

like image 263
Olle OlssN Avatar asked Jun 06 '11 23:06

Olle OlssN


1 Answers

The event keywords means only methods on the instance that hosts the SecondChanged field can invoke it. External attempts will fail.

like image 135
x0n Avatar answered Sep 29 '22 16:09

x0n