다음과 같은 설정이 있다고 가정 해 보겠습니다.객체가 범위를 벗어날 때 이벤트 핸들러는 어떻게됩니까?
public class ClassA
{
public event EventHandler SomeEvent;
}
public class ClassB : IDisposable
{
public void SomeMethod(ClassA value)
{
value.SomeEvent += (s, e) => { DoSomething(); };
}
void DoSomething() { }
void Dispose() { }
}
public static class Program
{
static void Main()
{
var a = new ClassA();
using (var b = new ClassB())
b.SomeMethod(a);
// POINT OF QUESTION!!
}
}
"POINT OF QUESTION"다음에 SomeEvent
이벤트가 발생하면 어떻게됩니까?
이 C#, .NET인가요? 내가 가서 그 태그를 추가했다;) – IAbstract