public PayOffSpread( [FactoryParameter("Option1")] PayOffBase payOff1, [FactoryParameter("Volume1")] double volume1, [FactoryParameter("Option2")] PayOffBase payOff2, [FactoryParameter("Volume2")] double volume2) { _payOff1 = payOff1; _volume1 = volume1; _payOff2 = payOff2; _volume2 = volume2; }
public static double PayOffEvaluation( [Parameter("PayOff")] ArgumentList payOff, [Parameter("Point for evaluation")] double spot) { PayOffBase payOffBase = Factory.GetInstance <PayOffBase>(payOff); // Note: In the above line there is an implicit conversion of payOff // from type ArgumentList to type Dictionary<String, Object>. // We could write this conversion explicitly in two steps: // Dictionary<String, Object> payOffDictionary = payOff; // PayOffBase payOffBase = Factory.GetInstance<PayOffBase>(payOffDictionary); return(payOffBase.Payoff(spot)); }