很抱歉这个问题可能太简单了,但我不知道如何实现。如果某个方法在一定时间内没有被调用,我需要引发一个事件(当我收到这个事件时,我会尝试解决问题。这是一种连接问题,我需要得到通知以尝试解决它 - 我将改变连接方式。)
public void MethodThatShouldBeCalledFrequently // acutally datagram from UDP received
{
// if not called for 5 seconds than raise event
}
public event EventHandler</*no parameters*/> MethodNotCalledForFiveSeconds; // connection problem, switch from UDP to TCP