static void Main(string[] args) { var fooHandle = new FooHandler(); var f1Filter = new F1Filter(); using (f1Filter) { fooHandle.AddF1Filter(f1Filter); // 其他业务 } HandleFoo(fooHandle); }
public void Dispose() { FooHandler.RemoveF1Filter(this); }