protected override void OnStop() { if (_listener == null) { throw new InvalidOperationException("Can't stop if not started"); } _listener.Stop(); _listener = null; }
protected override void OnStart() { if (_listener != null) { throw new InvalidOperationException("Already started"); } _listener = new GcEventListener(); _listener.GcEvents += OnGc; WriteLine(Header); }