/// <summary> /// Converts the given string value /// </summary> /// <param name="value"></param> /// <param name="targetType"></param> /// <param name="culture"></param> /// <returns></returns> /// <exception cref="FormatException"></exception> private static object Convert(string value, Type targetType, CultureInfo culture) { try { if (targetType.IsGenericType && targetType.GetGenericTypeDefinition() == typeof(Nullable <>)) { if (string.IsNullOrEmpty(value)) { return(null); } var valueType = Nullable.GetUnderlyingType(targetType); return(Convert(value, valueType, culture)); } return(ParseUtil.Parse(value, targetType, culture)); } catch (FormatException e) { throw new NotSupportedException("The value configurator does not support converting a string '" + value + "' to your '" + targetType + "' type!", e); } }