Specified CultureInfo when converting to and from strings across Json.NET.

Fixes:
Clone JToken when adding token with a parent to a new token.
This commit is contained in:
JamesNK
2008-03-16 03:04:28 +00:00
parent 010177a27d
commit 3d150fe2c3
32 changed files with 512 additions and 162 deletions
+5 -5
View File
@@ -290,7 +290,7 @@ namespace Newtonsoft.Json
return new DateTimeOffset((DateTime)value);
if (!targetType.IsAssignableFrom(valueType))
throw new InvalidOperationException(string.Format("Cannot convert object of type '{0}' to type '{1}'", value.GetType(), targetType));
throw new InvalidOperationException("Cannot convert object of type '{0}' to type '{1}'".FormatWith(value.GetType(), targetType));
return value;
}
@@ -348,7 +348,7 @@ namespace Newtonsoft.Json
private void SetObjectMember(JsonReader reader, object target, Type targetType, string memberName)
{
if (!reader.Read())
throw new JsonSerializationException(string.Format("Unexpected end when setting {0}'s value.", memberName));
throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(memberName));
MemberMappingCollection memberMappings = GetMemberMappings(targetType);
Type memberType;
@@ -392,7 +392,7 @@ namespace Newtonsoft.Json
else
{
if (_missingMemberHandling == MissingMemberHandling.Error)
throw new JsonSerializationException(string.Format("Could not find member '{0}' on object of type '{1}'", memberName, targetType.GetType().Name));
throw new JsonSerializationException("Could not find member '{0}' on object of type '{1}'".FormatWith(memberName, targetType.GetType().Name));
}
}
@@ -490,7 +490,7 @@ namespace Newtonsoft.Json
.SingleOrDefault();
if (!reader.Read())
throw new JsonSerializationException(string.Format("Unexpected end when setting {0}'s value.", memberName));
throw new JsonSerializationException("Unexpected end when setting {0}'s value.".FormatWith(memberName));
if (matchingConstructorParameter != null)
constructorParameters[matchingConstructorParameter] = CreateObject(reader, matchingConstructorParameter.ParameterType, null);
@@ -710,7 +710,7 @@ namespace Newtonsoft.Json
// continue
break;
default:
throw new InvalidOperationException(string.Format("Unexpected ReferenceLoopHandling value: '{0}'", _referenceLoopHandling));
throw new InvalidOperationException("Unexpected ReferenceLoopHandling value: '{0}'".FormatWith(_referenceLoopHandling));
}
}