/// <summary> /// Attempts to convert the value. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="converter"></param> /// <param name="value"></param> /// <param name="result"></param> /// <returns></returns> public static IResult TryConvertValue <T>(this IValueParser <T> converter, string value, out T result) { result = default; //Let default just pass on through and set the default value if (!value.CaseInsEquals("default") && !converter.Parser(value, out result)) { return(SetValueResult.FromError(converter, value, "Unable to convert.")); } if (result == null && converter.CannotBeNull) { return(SetValueResult.FromError(converter, value, "Cannot be set to 'NULL'.")); } return(converter.Validation(result) ?? Result.FromSuccess("Successfully converted")); }