internal static object ConvertTo(string valueString, Type type) { if (valueString == null) { return(null); } object value = ODataUriUtils.ConvertFromUriLiteral(valueString, ODataVersion.V3); bool isNonStandardEdmPrimitive; EdmLibHelpers.IsNonstandardEdmPrimitive(type, out isNonStandardEdmPrimitive); if (isNonStandardEdmPrimitive) { return(EdmPrimitiveHelpers.ConvertPrimitiveValue(value, type)); } else { type = Nullable.GetUnderlyingType(type) ?? type; return(Convert.ChangeType(value, type, CultureInfo.InvariantCulture)); } }
public void IsNullable_RecognizesClassesAndNullableOfTs(Type type, bool isNullable) { Assert.Equal(isNullable, EdmLibHelpers.IsNullable(type)); }