public void OnProductChanged(object sender, ProductChangeEventArgs product) { IEnumerable <IList <Client> > channels = _subscriptionList.Where(a => a.Key.GetType() == product.Part.GetType()).Select(a => a.Value); foreach (IList <Client> channel in channels) { foreach (Client client in channel) { client.HandlePartUpdate(product); } } }
public void HandlePartUpdate(ProductChangeEventArgs e) { Console.WriteLine($"I {NameOfClient} recieved an update for Part {e.Part.Name} for the price of {e.Part.Price}"); }