115
1
using System;
2
using System.Collections.Generic;
3
4
public class Program
5
{
6
public static void Main()
7
{
8
var product = new Product
9
{
10
Id = 1453,
11
Price = 1000M,
12
Stock = 0
13
};
14
15
product.Attach(new ProductPriceObserver());
16
product.Attach(new ProductStockObserver());
17
18
product.UpdatePrice(999M);
19
product.UpdateStock(10);
20
}
21
}
22
23
public record ProductObserverArgs
24
{
Cached Result