Skip to content

Commit

Permalink
Merge pull request #60 from cBrain-dk/Use-System.Net.Http.Headers.Aut…
Browse files Browse the repository at this point in the history
…henticationHeaderValue-to-parse-authentication-header

Use System.Net.Http.Headers.AuthenticationHeaderValue to parse authentication header
  • Loading branch information
JornWildt authored Jan 18, 2023
2 parents 0487f85 + 669c357 commit 3815eda
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions Ramone/MediaTypes/Xml/XmlSerializerCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
using System.Xml.Serialization;
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;


namespace Ramone.MediaTypes.Xml
{
public class XmlSerializerCodec : XmlStreamCodecBase
{
// The XmlSerializer is thread safe according to the online docs, so it should be safe
// to share instances.
static ConcurrentDictionary<Type, XmlSerializer> Serializers { get; set; }
static Dictionary<Type, XmlSerializer> Serializers { get; set; }


static XmlSerializerCodec()
{
Serializers = new ConcurrentDictionary<Type, XmlSerializer>();
Serializers = new Dictionary<Type, XmlSerializer>();
}


Expand All @@ -38,7 +38,11 @@ protected override void WriteTo(object item, XmlWriter writer, WriterContext con

protected XmlSerializer GetSerializer(Type t)
{
return Serializers.GetOrAdd(t, CreateSerializer);
if (!Serializers.ContainsKey(t))
{
Serializers[t] = CreateSerializer(t);
}
return Serializers[t];
}


Expand Down

0 comments on commit 3815eda

Please sign in to comment.