Search code examples
c#wcfserializationdatacontract

Override dictionary constructor for a WCF DataMember


Is it possible specify which constructor the WCF serialization engine uses when deserializing a data member?

For example: I want to use this constructor to make a case-insensitive dictionary without creating a new class that inherits from Dictionary.

[DataMember]
Dictionary<string, string> Values { get; set; }

// Values should be created with this constructor
new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);

Solution

  • Is it possible specify which constructor the WCF serialization engine uses when deserializing a data member?

    No it isn't, unless you use implement your custom serialization.