找出为什么调用 Disconnect 后,这个面板仍会收到更新。
csharp
public sealed class Dashboard
{
private readonly PriceFeed _feed;
public Dashboard(PriceFeed feed)
{
_feed = feed;
_feed.Changed += (_, price) => Show(price);
}
public void Disconnect()
{
_feed.Changed -= (_, price) => Show(price);
}
private void Show(decimal price) { }
}