private void OnCgtEventOccured(Date eventDate, IReadOnlyStock stock, int units, decimal costBase, decimal amountReceived, decimal capitalGain, CgtMethod cgtMethod, IPortfolioTransaction transaction) { // Make a temporary copy of the event to avoid possibility of // a race condition if the last subscriber unsubscribes // immediately after the null check and before the event is raised. var handler = CgtEventOccurred; if (handler != null) { var e = new CgtEventArgs() { EventDate = eventDate, Stock = stock, Units = units, CostBase = costBase, AmountReceived = amountReceived, CapitalGain = capitalGain, CgtMethod = cgtMethod, Transaction = transaction }; handler(this, e); } }
private void Holding_CgtEventOccurred(object sender, CgtEventArgs e) { _CgtEvents.Add(e.EventDate, e.Stock, e.Units, e.CostBase, e.AmountReceived, e.CapitalGain, e.CgtMethod); }