public static ParameterWithExample Convert(IParameter parameter) { var parameterWithExample = new ParameterWithExample(); var fields = parameter.GetType().GetFields(); foreach (var field in fields) { parameterWithExample .GetType() .GetField(field.Name) .SetValue(parameterWithExample, field.GetValue(parameter)); } return(parameterWithExample); }