diff options
author | JamesNK <james@newtonking.com> | 2011-02-24 04:46:00 +0300 |
---|---|---|
committer | JamesNK <james@newtonking.com> | 2011-02-24 04:46:00 +0300 |
commit | 1824aa4b59f2b81ecd0c0d9ad52676e1b8aa8f64 (patch) | |
tree | 5260d0755d631b7ca2fea1034741e3c2888f47b9 /Src/Newtonsoft.Json | |
parent | 05a4395a949d5a4a1347f85eaa9162852e21272e (diff) |
-Fixed duplicate type name within an assembly error
Diffstat (limited to 'Src/Newtonsoft.Json')
-rw-r--r-- | Src/Newtonsoft.Json/Linq/JValue.cs | 36 | ||||
-rw-r--r-- | Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs | 12 |
2 files changed, 37 insertions, 11 deletions
diff --git a/Src/Newtonsoft.Json/Linq/JValue.cs b/Src/Newtonsoft.Json/Linq/JValue.cs index 7da7678..9f89a62 100644 --- a/Src/Newtonsoft.Json/Linq/JValue.cs +++ b/Src/Newtonsoft.Json/Linq/JValue.cs @@ -167,20 +167,20 @@ namespace Newtonsoft.Json.Linq case JTokenType.Comment:
case JTokenType.String:
case JTokenType.Raw:
- string s1 = Convert.ToString(objA);
- string s2 = Convert.ToString(objB);
+ string s1 = Convert.ToString(objA, CultureInfo.InvariantCulture);
+ string s2 = Convert.ToString(objB, CultureInfo.InvariantCulture);
return s1.CompareTo(s2);
case JTokenType.Boolean:
- bool b1 = Convert.ToBoolean(objA);
- bool b2 = Convert.ToBoolean(objB);
+ bool b1 = Convert.ToBoolean(objA, CultureInfo.InvariantCulture);
+ bool b2 = Convert.ToBoolean(objB, CultureInfo.InvariantCulture);
return b1.CompareTo(b2);
case JTokenType.Date:
if (objA is DateTime)
{
- DateTime date1 = Convert.ToDateTime(objA);
- DateTime date2 = Convert.ToDateTime(objB);
+ DateTime date1 = Convert.ToDateTime(objA, CultureInfo.InvariantCulture);
+ DateTime date2 = Convert.ToDateTime(objB, CultureInfo.InvariantCulture);
return date1.CompareTo(date2);
}
@@ -555,12 +555,30 @@ namespace Newtonsoft.Json.Linq return Compare(_valueType, _value, otherValue);
}
- public int CompareTo(JValue other)
+ /// <summary>
+ /// Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
+ /// </summary>
+ /// <param name="obj">An object to compare with this instance.</param>
+ /// <returns>
+ /// A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings:
+ /// Value
+ /// Meaning
+ /// Less than zero
+ /// This instance is less than <paramref name="obj"/>.
+ /// Zero
+ /// This instance is equal to <paramref name="obj"/>.
+ /// Greater than zero
+ /// This instance is greater than <paramref name="obj"/>.
+ /// </returns>
+ /// <exception cref="T:System.ArgumentException">
+ /// <paramref name="obj"/> is not the same type as this instance.
+ /// </exception>
+ public int CompareTo(JValue obj)
{
- if (other == null)
+ if (obj == null)
return 1;
- return Compare(_valueType, _value, other._value);
+ return Compare(_valueType, _value, obj._value);
}
}
}
\ No newline at end of file diff --git a/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs b/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs index 8e88819..0df9f4a 100644 --- a/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs +++ b/Src/Newtonsoft.Json/Utilities/DynamicWrapper.cs @@ -79,8 +79,16 @@ namespace Newtonsoft.Json.Utilities if (wrapperType == null)
{
- wrapperType = GenerateWrapperType(interfaceType, realObjectType);
- _wrapperDictionary.SetType(interfaceType, realObjectType, wrapperType);
+ lock (_lock)
+ {
+ wrapperType = _wrapperDictionary.GetType(interfaceType, realObjectType);
+
+ if (wrapperType == null)
+ {
+ wrapperType = GenerateWrapperType(interfaceType, realObjectType);
+ _wrapperDictionary.SetType(interfaceType, realObjectType, wrapperType);
+ }
+ }
}
return wrapperType;
|