이 확장 메서드는 스레드로부터 안전합니까?확장 메서드 스레드가 안전합니까?
public static class Extensions
{
public static void Raise<T>(this EventHandler<T> handler,
object sender, T args) where T : EventArgs
{
if (handler != null) handler(sender, args);
}
}
또는이 값을 변경해야합니까?
public static class Extensions
{
public static void Raise<T>(this EventHandler<T> handler,
object sender, T args) where T : EventArgs
{
var h = handler;
if (h!= null) h(sender, args);
}
}
스레딩 관련 이벤트 디자인 및 구현 정보 http://stackoverflow.com/questions/786383/c-events-and-thread-safety – user44298