Skip to content

Commit

Permalink
Fix SortedList Serialization. Deserialization still failing.
Browse files Browse the repository at this point in the history
  • Loading branch information
lanwin committed Jun 18, 2010
1 parent eded1d5 commit a95cc7e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -213,7 +213,7 @@ public void CanSerializeSortedListDictionary()
{
var expectedBson = Serialize<Document>(new Document("Property", new Document { { "key1", 10 }, { "key2", 20 } }));
var obj = new SortedListDictionary { Property = new SortedList<string, int> { { "key1", 10 }, { "key2", 20 } } };
var bson = Serialize<GenericDictionary>(obj);
var bson = Serialize<SortedListDictionary>(obj);
Assert.AreEqual(expectedBson, bson);
}

Expand Down
Expand Up @@ -48,7 +48,9 @@ public IDictionaryAdapter GetDictionaryAdapter(Type type)
if (type.IsGenericType && !type.IsGenericTypeDefinition)
{
var genericType = type.GetGenericTypeDefinition();
if (genericType == typeof(IDictionary<,>) || genericType == typeof(Dictionary<,>))
if (genericType == typeof(IDictionary<,>) ||
genericType == typeof(Dictionary<,>) ||
genericType == typeof(SortedList<,>))
{
var genericArgs = type.GetGenericArguments();
Type adapterType = typeof(GenericDictionaryDictionaryAdapter<,>).MakeGenericType(genericArgs[0], genericArgs[1]);
Expand Down

0 comments on commit a95cc7e

Please sign in to comment.