GenericDictionaryCustomValue Sample

Back to summary

Source

using System.Collections.Generic;

namespace XmlSerializersTest.Samples
{
    [Title("Generic dictionary with custom value type")]
    public class GenericDictionaryCustomValue
    {
        public Dictionary<string, OneSimpleProperty> Things { get; set; }
    }
}

WCF Serializer

<GenericDictionaryCustomValue xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/XmlSerializersTest.Samples">
  <Things xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringOneSimplePropertyLWKRds8Z>
      <d2p1:Key>one</d2p1:Key>
      <d2p1:Value>
        <Value>1</Value>
      </d2p1:Value>
    </d2p1:KeyValueOfstringOneSimplePropertyLWKRds8Z>
  </Things>
</GenericDictionaryCustomValue>