Skip to content

Commit

Permalink
Wellknown serializers
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jan 21, 2022
1 parent 5e6a82a commit 16d269f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/WebSerializer/Providers/CollectionWebSerializerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ public sealed class CollectionWebSerializerProvider : IWebSerializerProvider
{
try
{
// Wellknown specialized types
if (type == typeof(Dictionary<string, string>))
{
return new DictionaryWebSerializer<Dictionary<string, string>, string, string>();
}
else if (type == typeof(Dictionary<string, object>))
{
return new DictionaryWebSerializer<Dictionary<string, object>, string, object>();
}
else if (type == typeof(KeyValuePair<string, string>[]))
{
return new EnumerableKeyValuePairWebSerializer<KeyValuePair<string, string>[], string, string>();
}
else if (type == typeof(KeyValuePair<string, object>[]))
{
return new EnumerableKeyValuePairWebSerializer<KeyValuePair<string, object>[], string, object>();
}

if (type.IsGenericType || type.IsArray)
{
// Generic Dictionary
Expand Down

0 comments on commit 16d269f

Please sign in to comment.