示例#1
0
文件: Program.cs 项目: pecen/Sandbox
        private static void Stock_PriceChanged(object sender, PriceChangedEventArgs e)
        {
            var increase = (e.NewPrice - e.LastPrice) / e.LastPrice;

            if (increase >= 0.1m)
            {
                WriteLine("Alert, 10% or more stock price increase!");
            }
            else
            {
                WriteLine("Price increase less than 10%");
            }
            WriteLine($"Increase = {Math.Round(increase * 100, 2)}%");
        }
示例#2
0
 protected virtual void OnPriceChanged(PriceChangedEventArgs e)
 {
     PriceChanged?.Invoke(this, e);
 }