Question regarding to value/reference type of events

Posted by Petr on Stack Overflow See other posts from Stack Overflow or by Petr
Published on 2010-04-08T07:16:29Z Indexed on 2010/04/08 7:23 UTC
Read the original article Hit count: 229

Filed under:
|
|

Hi, On the MSDN, I have found following:

public event EventHandler<MyEventArgs> SampleEvent;

public void DemoEvent(string val)
{
// Copy to a temporary variable to be thread-safe.
    EventHandler<MyEventArgs> temp = SampleEvent;
    if (temp != null)
        temp(this, new MyEventArgs(val));
}

I do not understand, "copy to temporary variable", isnt it reference type?

© Stack Overflow or respective owner

Related posts about c#

Related posts about events