public class MyTimer {
private readonly Action _fireOnInterval;
public MyTimer(Action fireOnInterval, TimeSpan interval, ...) {
if (fireOnInterval == null) {
throw new ArgumentNullException("fireOnInterval");
}
_fireOnInterval = fireOnInterval;
}
private void Fire() {
_fireOnInterval();
}
...
}
Вы можете назвать это так:
new MyTimer(() => MessageBox.Show("Elapsed"), TimeSpan.FromMinutes(5), ...)