Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/RestSharp/Extensions/ReflectionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public static bool IsSubclassOfRawGeneric(this Type toCheck, Type generic)
return false;
}

internal static object ChangeType(this object source, Type newType, IFormatProvider provider) => Convert.ChangeType(source, newType, provider);

internal static object ChangeType(this object source, Type newType) => Convert.ChangeType(source, newType);

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/RestSharp/Serializers/Json/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ object ConvertValue(TypeInfo typeInfo, object value)
}

var type = typeInfo.AsType();
if (typeInfo.IsPrimitive) return value.ChangeType(type);
if (typeInfo.IsPrimitive) return value.ChangeType(type, Culture);

if (typeInfo.IsEnum) return type.FindEnumValue(stringValue, Culture);

Expand Down