public void SetParam <T>(Parameter parameter, T value) { var paramTypeInfo = new ParameterTypeInfo(parameter); if (paramTypeInfo.Type != typeof(T)) { throw new ArgumentException($"Wrong return generic type argument. Must be {paramTypeInfo.Type.Name}"); } paramTypeInfo.SetParamValue(this, value); }
public T ReadParam <T>(Parameter parameter) { var paramTypeInfo = new ParameterTypeInfo(parameter); if (paramTypeInfo.Type != typeof(T)) { throw new ArgumentException($"Wrong return generic type argument. Must be {paramTypeInfo.Type.Name}"); } var paramValue = paramTypeInfo.ReadParamValue(this); if (!(paramValue is T)) { throw new ArgumentException("Return type of native readParam method is not equal to generic type parameter"); } return((T)paramValue); }