public void Evaluate(ITimedValue value) { //find the ITimedValue's true type's GTA, and look up the implementation var genType = value.GetType().GetGenericArguments()[0]; //the specific implementation should convert the values to the specific type. Implementations[genType].Evaluate(value); }
public void Evaluate(ITimedValue value) { //find the ITimedValue's true type's GTA, and look up the implementation var genType = value.GetType().GetGenericArguments()[0]; //Since we're passing a reference to the base ITimedValue interface, //we will call the Evaluate overload from the base ITimedValueEvaluator interface, //and each implementation should cast value to the correct generic type. Implementations[genType].Evaluate(value); }