XML Serializable Generic Dictionary

XML Serializable Generic Dictionary

For some reason, the generic Dictionary in .net 2.0 is not XML serializable.  The following code snippet is a xml serializable generic dictionary.  The dictionary is serialzable by implementing the IXmlSerializable interface. 

    using System;

    using System.Collections.Generic;

    using System.Text;

    using System.Xml.Serialization;

 

    [XmlRoot("dictionary")]

    public class SerializableDictionary<TKey, TValue>

        : Dictionary<TKey, TValue>, IXmlSerializable

    {

        #region IXmlSerializable Members

        public System.Xml.Schema.XmlSchema GetSchema()

        {

            return null;

        }

 

        public void ReadXml(System.Xml.XmlReader reader)

        {

            XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));

            XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));

 

            bool wasEmpty = reader.IsEmptyElement;

            reader.Read();

 

            if (wasEmpty)

                return;

 

            while (reader.NodeType != System.Xml.XmlNodeType.EndElement)

            {

                reader.ReadStartElement("item");

 

                reader.ReadStartElement("key");

                TKey key = (TKey)keySerializer.Deserialize(reader);

                reader.ReadEndElement();

 

                reader.ReadStartElement("value");

                TValue value = (TValue)valueSerializer.Deserialize(reader);

                reader.ReadEndElement();

 

                this.Add(key, value);

 

                reader.ReadEndElement();

                reader.MoveToContent();

            }

            reader.ReadEndElement();

        }

 

        public void WriteXml(System.Xml.XmlWriter writer)

        {

            XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));

            XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));

 

            foreach (TKey key in this.Keys)

            {

                writer.WriteStartElement("item");

 

                writer.WriteStartElement("key");

                keySerializer.Serialize(writer, key);

                writer.WriteEndElement();

 

                writer.WriteStartElement("value");

                TValue value = this[key];

                valueSerializer.Serialize(writer, value);

                writer.WriteEndElement();

 

                writer.WriteEndElement();

            }

        }

        #endregion

    }

Update: Fixed bug Justin pointed out by adding an extra reader.ReadEndElement() and by checking the IsEmptyElement property.

Published Wednesday, May 03, 2006 12:13 PM by pwelter34
Filed under:

Comments

# re: XML Serializable Generic Dictionary

I wrote about this issue five months back at and added a CodeSmith generation template:
http://www.justinangel.net/e/CommentView,guid,55167d3d-b4ac-40be-9909-402e3783edab.aspx

BTW, your code is buggy. If you put this Generic dictionary as part of another class it will not desirilize properly. The read method is missing a few reads so the XmlReader will not be set correctly for any items in the XML after this Generic dictionary.

Wednesday, May 03, 2006 2:38 PM by Justin-Josef Angel

# re: XML Serializable Generic Dictionary

Justin,

Do you have an example of what will cause it to fail? I've done a lot of testing but must have missed a use case. Thanks for the heads up.

~ Paul

Wednesday, May 03, 2006 2:44 PM by Paul Welter

# re: XML Serializable Generic Dictionary

Try and create a class with the SerializableAttribute and properties of type string, SerializableDictionary, string (in that order).

Make a webservice method that returns this class (with some content, meaning that string should have a value and the dirctionary should have at least two values).

Look the the XML the webservice generates and see it's OK.

Create a proxy to the webservice and call the webservice method you just created. The class you deserialize will have no value for the string that comes after the SerializableDictionary. (At least i think it won't). If i'm right and that issue does exist it's because you don't read the </dictionary> element at the end of ReadXml.

Wednesday, May 03, 2006 4:12 PM by Justin-Josef Angel

# re: XML Serializable Generic Dictionary

Ok, I fixed the issue. I got about 30 test cases for this now. Should be fairly solid. No guarantees of course. :)

~ Paul

Wednesday, May 03, 2006 4:20 PM by Paul Welter

# re: XML Serializable Generic Dictionary

Hi Paul,

Thanks for creating this, saved me time!

Ward

Monday, May 15, 2006 4:04 AM by Ward Bekker

# re: XML Serializable Generic Dictionary

This doesn't seem to work if you have a dictionary of custom types.

I.E. SerializableDictionary<int, MyObject>

Monday, May 15, 2006 4:08 PM by Brian

# re: XML Serializable Generic Dictionary

Brian,

It should work as long as MyObject is Xml Serializable. Try to serialize MyObject first to see if it works.

~ Paul

Monday, May 15, 2006 4:11 PM by Paul Welter

# re: XML Serializable Generic Dictionary

Nevermind! Ignore previous comment.

Monday, May 15, 2006 4:13 PM by Brian

# re: XML Serializable Generic Dictionary

Paul it does, my goof. Thanks this is very helpful.

Monday, May 15, 2006 4:14 PM by Brian

# re: XML Serializable Generic Dictionary

Thanks, Paul. This is really neat. I have a WebMethod returning a SerializableDictionary. This works fine when I view the service in a browser, & call the method there, but somehow does not work from a fat-client. In fact the generated wsdl does not show the response-type as above. So, am not sure whether i need to do anything special to get it in my proxy?

Monday, August 28, 2006 10:45 AM by Mark

# re: XML Serializable Generic Dictionary

Thanks for your code-example, but I get an error-message, by using this solution. I define the SerializableDictionary, the key (an enumeration) and value (a struct with two items from datatype string) in an own ClassLibrary. When I use a method in a WebService1 like this public SerializableDictionary testSD1() { SerializableDictionary sd = new SerializableDictionary(); sd.Add(eKeys.key1, new sValues("value1", "value2")); return sd; } It works. When I test it, i get an XML-Document with all Information. When I use a second method in a WebService2: [WebMethod] public System.Xml.XmlDocument testSD4() { localhost.Service ws = new localhost.Service(); datatype.SerializableDictionary sd; System.Data.DataSet ds = ws.testSD1(); System.Xml.XmlDocument xd = new System.Xml.XmlDocument(); xd.LoadXml(ds.GetXml()); return xd; } I recieve just this: Can you help me please? Thanks.

Monday, September 25, 2006 4:36 AM by Matthias

# re: XML Serializable Generic Dictionary

Great piece of code. Thanks very much.

Monday, October 16, 2006 7:28 AM by Pablo

# re: XML Serializable Generic Dictionary

Hi, Thanks for the code... I appreciate your effort. I'm having some problems though.... 1. When I used the code as is, I got this error ... [SerializationException: Type 'Microsoft.Exchange.HostedServices.Clients.Utilities.SerializableDictionary`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[Microsoft.Exchange.HostedServices.Clients.Membership.User, Microsoft.Exchange.HostedServices.Clients.Membership, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]' in Assembly 'Microsoft.Exchange.HostedServices.Clients.Utilities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.] I marked it as [Serializable] and then I got the following error... {"The constructor to deserialize an object of type 'Microsoft.Exchange.HostedServices.Clients.Utilities.SerializableDictionary`2[System.String,Microsoft.Exchange.HostedServices.Clients.Membership.User]' was not found."} Then I added the following... protected SerializableDictionary(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } Now there are no errors, but the serialization/deserialization didn't seem to work at all. ReadXml and WriteXml methods were never called... BTW, I'm storing SerializableDictionary object in session as follows... HttpContext.Current.Session["UserAccounts"] = new SerializableDictionary(); ((SerializableDictionary)HttpContext.Current.Session["UserAccounts"])[emailAddress] = user; I'm stuck... Any help/feedback is appreciated. Thank you, Srivalli

Thursday, October 26, 2006 8:48 PM by Srivalli

# re: XML Serializable Generic Dictionary

A sample peice of C# code to exercise this in unit tests would appreciated.

Friday, October 27, 2006 6:31 AM by Tatworth

# Web 2.0 &raquo; Blog Archives &raquo; Merriam-Webster&#8217;s Spanish-English Dictionary 2.0 from email marketing

# Web 2.0 &raquo; Blog Archives &raquo; Smartphone.net - Windows Mobile Smartphone Software, News, Etc

# Serializable Generic Dictionary

In CommunityServer Enterprise Reporting ,we&#39;re using a neat web service to make our architecture

Thursday, June 07, 2007 2:09 AM by Telligent.Interns[0] = "Ryan Hoffman";

# Web 2.0 &raquo; Blog Archives &raquo; Find Shorter Oxford English Dictionary Windows Version 2.0

Pingback from  Web 2.0  &raquo; Blog Archives   &raquo; Find Shorter Oxford English Dictionary Windows Version 2.0

# re: XML Serializable Generic Dictionary

Just want to let you know that your little piece works wonders, and saved me quite a few headaches.

Thanks for sharing!

Sunday, July 15, 2007 6:55 PM by Balslev

# JSON in C# (Part 1)

JSON in C# (Part 1)

Wednesday, August 01, 2007 12:53 AM by Nimble Coder

# Code Pagoda &raquo; Blog Archive &raquo; Pass Dictionary Object Params To Your Web Service

Pingback from  Code Pagoda  &raquo; Blog Archive   &raquo; Pass Dictionary Object Params To Your Web Service

# re: XML Serializable Generic Dictionary

Great snippet for sure! Thanks for sharing it with us! I am having a problem, however, I hoped I could get some help with:

I have a web service with a webmethod (where I expect a SerializableDictionary<string,string> as a parameter). When I generate the client-proxy the reference.cs auto-generated class shows that parameter to be System.Data.Dataset instead of MyNamespace.SerializableDictionary<string,string>. Any attempts thus far to generate the schema manually has lead to dead ends ...

How can I (other than manually) Specify the schema for serializing the SerializableDisctionary so that the client "sees" a serializable dictionary as the parameter to this web method?

Wednesday, September 12, 2007 10:03 AM by Gary

# re: XML Serializable Generic Dictionary

@Srivalli

You have to call the base constructor of the Dictionary class it's inheriting to get it to work. Adding the following constructors should get it to work exactly like the real Dictionary implementation:

       public SerializableDictionary()

           : base()

       {

       }

       public SerializableDictionary(IDictionary<TKey, TValue> dictionary)

           : base(dictionary)

       {

       }

       public SerializableDictionary(IEqualityComparer<TKey> comparer)

           : base(comparer)

       {

       }

       public SerializableDictionary(int capacity)

           : base(capacity)

       {

       }

       public SerializableDictionary(IDictionary<TKey, TValue> dictionary, IEqualityComparer<TKey> comparer)

           : base(dictionary, comparer)

       {

       }

       public SerializableDictionary(int capacity, IEqualityComparer<TKey> comparer)

           : base(capacity, comparer)

       {

       }

       protected SerializableDictionary(SerializationInfo info, StreamingContext context)

           : base(info, context)

       {

       }

Wednesday, September 19, 2007 8:58 PM by Thomas

# re: XML Serializable Generic Dictionary

Thanks for putting this out there.  Worked like a charm!

Friday, September 21, 2007 5:25 PM by Chad

# re: XML Serializable Generic Dictionary

Pingback from code-news.blogspot.com

Sunday, October 14, 2007 11:07 AM by Code

# re: XML Serializable Generic Dictionary

@gary

You must bind an XmlSchemaProvider in order to get the type to change on a remote web service.

I built upon Paul's version for working VB code using a dictionary of type (string, object)

miedlar.com/.../serializabledictionary

<a href='miedlar.com/.../serializabledictionary'>here</a>

Friday, October 26, 2007 6:53 PM by Brian Miedlar

# huseyint.com &raquo; XML Serializable Generic Dictionary tipi

Pingback from  huseyint.com &raquo; XML Serializable Generic Dictionary tipi

Sunday, December 02, 2007 9:50 AM by huseyint.com » XML Serializable Generic Dictionary tipi

# re: XML Serializable Generic Dictionary

Hello,

I get an exception when I try to serialize a property that uses this.  The problem seems to be that I have decorated the property with XmlArrayAttribute and XmlArrayItemAttribute.  Reading the msdn docs, this should be valid for any type that implements IEnumerable, as your class inherits from Dictionary I should be ok.  Any suggestions?

SerializableDictionary<string,object> _objectTypes = new SerializableDictionary<string,object>();

       [XmlArray("object_definitions")]

       [XmlArrayItem(typeof(UiConfiguratorPlugin), ElementName = "object_type", Namespace = XMLNamespaces.UiConfiguratorPlugin)]

       [XmlArrayItem(typeof(ProtocolRunnerPlugIn), ElementName = "object_type", Namespace = XMLNamespaces.ProtocolRunnerPlugIn)]

       //[XmlAnyElement("object_type")]      

       public SerializableDictionary<string, object> ObjectTypes

       {

           get { return _objectTypes; }

           set { _objectTypes = value; }

       }

Thursday, December 13, 2007 5:50 AM by alastair green

# re: XML Serializable Generic Dictionary

Sorry if its been posted already, but if you are trying to put this collection into ViewState, you will need to explicitly implement a constructor on the Dictionary for it to deserialise properly.   I implemented them all explicitly as pass-through methods, simply calling base.

Please refer to:

michhes.blogspot.com/.../generic-dictionary-wrapper-class-cannot.html

Thanks.

Thursday, December 13, 2007 10:38 AM by Adam

# re: XML Serializable Generic Dictionary

At string writer.WriteStartElement("item");

InvalidOperationException :

Token StartElement in state EndRootElement would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment.

Monday, December 31, 2007 11:40 AM by Yury

# re: XML Serializable Generic Dictionary

In my thin client i'm unable to properly parse the xml generated by this class. It treats the SerializedDictionary object as a DataSet, but the data set is empty.

Help!

Wednesday, January 09, 2008 4:56 PM by Tim

# re: XML Serializable Generic Dictionary

The class does not work for properties and for subclasses:

public class Test

{

 private SerializableDictionary<string, string> _sd = new SerializableDictionary<string, string>();

 public Test() { _sd.Add("name", "value"); }

 public SerializableDictionary<string, string> SD { get { return _sd; } }

}

Test t = new Test();

XmlSerializer serializer = new XmlSerializer(t.GetType());

StreamWriter writer = new StreamWriter("c:\\t.xml");

serializer.Serialize(writer, t);

writer.Close();

Outputs only

 <?xml version="1.0" encoding="utf-8" ?>

- <Test xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema">

 </Test>

Friday, January 18, 2008 7:14 AM by Alex

# re: XML Serializable Generic Dictionary

Important: readonly public variables and get-only properties cannot be serialized to XML!

Friday, January 18, 2008 11:52 AM by Alex

# re: XML Serializable Generic Dictionary

You are a genious!

Thanks a lot.

Wednesday, January 30, 2008 7:19 PM by Gleb

# re: XML Serializable Generic Dictionary

Im having a problem using this with TryGetValue (trying to ensure thread safety).

I have a SiteMapDataSource that i get a System.NullReferenceException on (CurrentNode==null).

       protected void menu_MenuItemDataBound(Object sender, MenuEventArgs e)

       {

          if (e.Item.Text == SiteMapDataSource 1.Provider.CurrentNode.Title)

           {

               e.Item.Text = "<strong>" + e.Item.Text + "</strong>";

           }

       }

But if i just skip the first if() everything works like a charm.

string tempCountryCode="uk";

bool contains;

           if (page.CountryCodeDictionary.TryGetValue(tempCountryCode.ToLower(), out contains))

           {

               if (SupportRoles.isAdmin(HttpContext.Current.Request.LogonUserIdentity) || page.CountryCodeDictionary[tempCountryCode])

               {

                   return true;

               }

               else

               {

                   return false;

               }

           }

           else

           {

               return false;

           }

Would be great if somebody knew what was causing this.

Friday, February 01, 2008 3:48 PM by Sowokie

# re: XML Serializable Generic Dictionary

This works great.  However, I am having one problem, when returning a Serializable dictionary from my web service, it is being treated as a DataSet.

Is there any way to have this serialize as a two dimensional array instead of a dataset.  This would also ensure that any type contained in the dictionary will have its type definition included in both the wsdl and the reference.cs web service proxy which is created on the client side.

Wednesday, February 13, 2008 4:19 PM by Jason

# re: XML Serializable Generic Dictionary

I am having problems with this simple routine:

   <WebMethod()> Public Function GetBorough(ByVal iCompID As Integer) As SerializableDictionary(Of String, String)

       Dim oSearchResult As New SerializableDictionary(Of String, String)

       oSearchResult.Add("1", "one")

       Return oSearchResult

   End Function

----------------------------------------

Error is:

- The request failed with the error message:

--

System.InvalidOperationException: The top XML element 'dictionary' from namespac

e 'http://tempuri.org/' references distinct types SerializableDictionary`2[Syste

m.String,Photo] and SerializableDictionary`2[System.String,System.String]. Use X

ML attributes to specify another XML name or namespace for the element or types.

  at System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(Accessor

accessor, NameTable accessors)

  at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel mod

el, XmlRootAttribute root, String defaultNamespace)

  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type

, XmlRootAttribute root, String defaultNamespace)

  at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type

, XmlRootAttribute root)

  at System.Web.Services.Description.MimeXmlReflector.ReflectReturn()

  at System.Web.Services.Description.HttpProtocolReflector.ReflectMimeReturn()

  at System.Web.Services.Description.HttpPostProtocolReflector.ReflectMethod()

  at System.Web.Services.Description.ProtocolReflector.ReflectBinding(Reflected

Binding reflectedBinding)

  at System.Web.Services.Description.ProtocolReflector.Reflect()

  at System.Web.Services.Description.ServiceDescriptionReflector.ReflectInterna

l(ProtocolReflector[] reflectors)

  at System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type t

ype, String url)

  at System.Web.Services.Protocols.DiscoveryServerType..ctor(Type type, String

uri)

  at System.Web.Services.Protocols.DiscoveryServerProtocol.Initialize()

  at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, Http

Context context, HttpRequest request, HttpResponse response, Boolean& abortProce

ssing)

---------------------------

When I comment above function out, web service compiles fine. Any ideas anybody?  Also, this works fine with other dictionaries.

Monday, February 18, 2008 6:53 PM by Gleb

# SharePoint Conference 2008 - Day 4 &laquo; Steve Pietrek&#8217;s SharePoint Stuff

Pingback from  SharePoint Conference 2008 - Day 4 &laquo; Steve Pietrek&#8217;s SharePoint Stuff

# re: XML Serializable Generic Dictionary

It doesn't work for me. :(

I'm serializing to a file. The test output looks like:

<item><key><string>Key1</string></key><value><string>Value1</string></value></item>

<item><key><string>Key2</string></key><value><string>Value2</string></value></item>

<item><key><string>Key3</string></key><value><string>Value3</string></value></item>

except its not wrapped... it's all on one line.

Isn't there supposed to be a root element?

It fails on the first reader.ReadEndElement() in ReadXml(), with the exception:

"There are multiple root elements. Line 1, position 85."

That column (85) is where the second <item> tag starts.

I'm a noob, and there's no usage example. :(

I used:

XmlTextWriter writer = new XmlTextWriter(@"c:\tmp\test2.xml", System.Text.Encoding.Default);

and

XmlTextReader reader = new XmlTextReader(@"c:\tmp\test.xml");

Suggestions? I'm sure I'm just calling it wrong, since it's working for everyone else.

Thanks, Hoytster

Thursday, March 13, 2008 8:51 AM by Hoytster

# XML Serializable Generic Dictionary tipi | Turk Bili??im Teknolojileri Ve G??venlik Platformu | iyinet webmaster forumu 2008 seo yar????mas?? |

Pingback from  XML Serializable Generic Dictionary tipi | Turk Bili??im Teknolojileri Ve G??venlik Platformu | iyinet webmaster forumu 2008 seo yar????mas?? |

# re: XML Serializable Generic Dictionary

Thanks so much. Works perfectly for what I need. Nice to see it still being found so easily years later!

Thursday, April 03, 2008 11:29 AM by Greg Harris

# re: XML Serializable Generic Dictionary

why is :

SerializableDictionary<string, string> _testdict;

       [System.Runtime.Serialization.DataMember]

       public SerializableDictionary<string, string> TestCollection

       {

           get { return _testdict; }

           set { _testdict = value; }

       }

resulting in:

[System.Xml.Serialization.XmlElementAttribute(Order=0)]

       public System.Data.DataSet TestCollection

       {

           get

           {

               return this.testCollectionField;

           }

           set

           {

               this.testCollectionField = value;

           }

       }

dont want a DATASET !!! what can i change !!! (other then that this is a great class)

Monday, May 05, 2008 4:38 PM by Darin

# re: XML Serializable Generic Dictionary

It works wonders, thanks. It saved me a lot of time.

Tuesday, May 06, 2008 6:22 AM by BrightSoul

# re: XML Serializable Generic Dictionary

public ref class StringDict : public SerializableDictionary<System::String^, System::String^> {};

bool foobool = true;

StringDict ^ userData = gcnew StringDict();

userData["foo"] = foobool ? "1":"0";

userData["bar"] = "theone";

userData["fobia"] = "really";

XmlTextWriter ^ xmlWriter = gcnew XmlTextWriter("dict.xml", nullptr);

xmlWriter->Formatting = Formatting::Indented;

xmlWriter->WriteStartElement("addondata");

userData->WriteXml(xmlWriter);

xmlWriter->WriteEndElement();

xmlWriter->Close();

XmlTextReader ^ xmlReader = gcnew XmlTextReader("dict.xml");

StringDict ^ sd = gcnew StringDict();

xmlReader->ReadStartElement("addondata");

sd->ReadXml(xmlReader);

xmlReader->Close();

Tuesday, May 13, 2008 9:20 AM by jan wilmans

# re: XML Serializable Generic Dictionary

I am having the same problem mentioned in several other posts on this article, that being, the class deserializes as a DataSet for some unknown reason.

Strangely enough I have used it with success elsewhere. Am I missing something small but fundamental?

Tuesday, May 27, 2008 1:39 PM by Craig

# re: XML Serializable Generic Dictionary

Using in code

-------------------------

string txt;

       using (StringWriter string_writer = new StringWriter())

       {

           xml_serializer.Serialize(string_writer, sd);

           txt = string_writer.ToString();

           string_writer.Close();

       }

                      SerializableDictionary<string, string> _sd = new SerializableDictionary<string, string>();

               using (StringReader string_reader = new StringReader(txt))

               {

                   _sd = (SerializableDictionary<string, string>)xml_serializer.Deserialize(string_reader);

               }

Wednesday, May 28, 2008 10:55 AM by Surya

# re: XML Serializable Generic Dictionary

Thanks... works a treat.

Friday, May 30, 2008 8:29 AM by Graham

# re: XML Serializable Generic Dictionary

Thanks for the tip!

Wednesday, June 04, 2008 9:44 AM by Amer Gerzic

# re: XML Serializable Generic Dictionary

Really great work... thanks for sharing it!

Wednesday, June 11, 2008 3:30 PM by Samuel

# re: XML Serializable Generic Dictionary

This is not writing the dictionary, this is writing the contents of the dictionary. It should encapsulate the content in another element.

Tuesday, June 17, 2008 1:17 PM by Charlie

# XmlConverter - serialize/deserialize an object to Xml &laquo; GAnton&#8217;s Weblog

Pingback from  XmlConverter - serialize/deserialize an object to Xml &laquo; GAnton&#8217;s Weblog

# re: XML Serializable Generic Dictionary

You rock. Thank you, you saved me hours!

Saturday, June 21, 2008 1:54 PM by Steve

# re: XML Serializable Generic Dictionary

Thanks , Saved my alot of time.

Thursday, July 24, 2008 10:28 AM by shahzad

# Displaying large amount of data in DataGridView | devintelligence.com

Pingback from  Displaying large amount of data in DataGridView | devintelligence.com

# re: XML Serializable Generic Dictionary

Absolutely great! Thanks for sharing, works great!

Sunday, August 10, 2008 3:47 PM by Reino Boonstra

# re: XML Serializable Generic Dictionary

To be able to deserialize the dictionary with a binary formatter add constructor:

protected XmlDictionary(SerializationInfo info, StreamingContext context)

           : base(info, context)

       {

       }

Tuesday, August 12, 2008 4:43 AM by Magnus

# re: XML Serializable Generic Dictionary

I am trying to call the Add method on the Dictionary from diffrent pages, i have to create a new instance of Dictionary, and my data from first page is not reflected in the next page.

Can you help?

Monday, August 18, 2008 9:14 AM by Developer

# Serializable dictionary &laquo; Billy club Weblog

Pingback from  Serializable dictionary &laquo; Billy club Weblog

Sunday, August 31, 2008 7:32 AM by Serializable dictionary « Billy club Weblog

# XmlConverter - serialize/deserialize an object to/from Xml &raquo; Anton Gochev&#8217;s Weblog

Pingback from  XmlConverter - serialize/deserialize an object to/from Xml &raquo; Anton Gochev&#8217;s Weblog

# re: XML Serializable Generic Dictionary

serializable dictinary is compiled as a dataset//how can I fix this?

Sunday, October 26, 2008 4:39 AM by maha

# re: XML Serializable Generic Dictionary

Hi there,

Serializable dictinary is compiled as a dataset, is there a way to fix this???

I'm using a work arround returning a String :S! because is better for me than replace it manually each time that I updated my references

To send:

StringWriter Output = new StringWriter(new StringBuilder());

           XmlSerializer xs = new XmlSerializer(typeof(SerializableDictionary<string, string>));

           xs.Serialize(Output, _SettingsFromWeb.AppSettings);            

           return Output.ToString();

And to receive

after get the string (settingString) from the web method

  XmlSerializer s = new XmlSerializer(typeof(SerializableDictionary<string, string>));

           SerializableDictionary<string, string> setting =

               (SerializableDictionary<string, string>)s.Deserialize(new StringReader(settingString));

Any suggestion??

Friday, November 14, 2008 8:26 PM by iHenry

# re: XML Serializable Generic Dictionary

Many thanks for that!

Monday, December 15, 2008 9:51 PM by Krzysztof Sledziewski

# re: XML Serializable Generic Dictionary

i am trying to use this code but getting an error.. i am using the Dictionary<string,Myobject>  While serializing this object i am getting this error .

"Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."

class people

{

   extendedproperties SerializableDictionary<string,MyObject>;

}

in this case i am adding an extended property of type 'Person' in to people. now i try to serialize the People object. My person object is serializable object. can you tell me where i am going wrong. Thanks in advance.

Tuesday, December 23, 2008 2:16 PM by Pavan

# re: XML Serializable Generic Dictionary

Thank you for sharing, Paul.  It works great for my Settings.settings and Settings.Designer.cs files.

It's a shame C# 2.0 didn't come stock with a serializable dictionary.

Monday, December 29, 2008 9:25 PM by Seanba

# re: XML Serializable Generic Dictionary

Many thanks for that!

# re: XML Serializable Generic Dictionary

Thank you for your efforts Paul.

Monday, January 12, 2009 3:55 AM by Amol

# re: XML Serializable Generic Dictionary

Many thanks Paul, I was going mad debugging until I found this - and it seems to work OK if you change it to a SortedDictionary too.

Monday, January 19, 2009 6:20 AM by Steve

# re: XML Serializable Generic Dictionary

Thanks! I appreciate you sharing your expertise.

Tuesday, February 03, 2009 3:40 AM by Dean

# re: XML Serializable Generic Dictionary

Good job Paul! Kudos!

Sunday, February 08, 2009 5:41 AM by Mark

# Diccionario serializable &laquo; Tempus Fugit

Pingback from  Diccionario serializable &laquo; Tempus Fugit

Tuesday, February 24, 2009 5:43 AM by Diccionario serializable « Tempus Fugit

# re: XML Serializable Generic Dictionary

Thanks! You sure saved me lots of times and headaches.

Wednesday, March 04, 2009 8:03 AM by Alpha

# Ana??l Abrantes : mon blog technique .net &raquo; S??rialiser un dictionnaire g??n??rique (Dictionary)

Pingback from  Ana??l Abrantes : mon blog technique .net  &raquo; S??rialiser un dictionnaire g??n??rique (Dictionary)

# re: XML Serializable Generic Dictionary

Sehr wertvolle Informationen! Empfehlen!

Friday, March 13, 2009 10:11 AM by ...

# re: XML Serializable Generic Dictionary

Sehr gute Seite. Ich habe es zu den Favoriten.

Saturday, March 14, 2009 3:52 PM by ...

# re: XML Serializable Generic Dictionary

Wouldn't the below be a little more efficient

if (reader.IsEmptyElement)

       return;

reader.Read();

instead of

bool wasEmpty = reader.IsEmptyElement;

reader.Read();

if (wasEmpty)

       return;

Monday, March 16, 2009 4:36 PM by Kent

# re: XML Serializable Generic Dictionary

Friday, April 10, 2009 11:25 AM by nick_ropasl

# Wie sichert man am besten Programmdaten und Arrays - Seite 2 | hilpers

Pingback from  Wie sichert man am besten Programmdaten und Arrays - Seite 2 | hilpers

# re: XML Serializable Generic Dictionary

Thanks! very useful

Sunday, April 12, 2009 9:17 PM by Nay

# re: XML Serializable Generic Dictionary

Thanks! very useful.

Tuesday, April 21, 2009 11:48 AM by midas

# re: XML Serializable Generic Dictionary

Hi,

i encountered the same problem as Pavan, when trying to serialize "own user- objects" i also got this error:

InvalidOperationException:

"Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."

This error occurs because the serializer does not know the Types to be Serialized/Deserialized, but you can feed the

serializer with the missing types:

   [XmlRoot("dictionary")]

   public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>, IXmlSerializable

   {

public static List<Type> AdditionalTypes = new List<Type>();

...

XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));

           XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue),AdditionalTypes.ToArray());

...

XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));

           XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue),AdditionalTypes.ToArray());

...

In this snippet I included a static list of the Types to be Serialized. The list has to be initialized with the "additional" Types that are but as "Values" in the Dictionary.

This solution work pretty well for me,

please let me know what you think about it.

Greetings

Thomas

Wednesday, May 13, 2009 5:39 AM by Thomas U.

# re: XML Serializable Generic Dictionary

Spectacular sir!

You are a gentleman and a scholar!

You give blogs a good name!

Tuesday, May 19, 2009 8:56 PM by Jeff

# re: XML Serializable Generic Dictionary

Pingback from  Wie sichert man am besten Programmdaten und Arrays - Seite 2 | hilpers

Thursday, June 04, 2009 7:17 AM by islami sohbet

# re: XML Serializable Generic Dictionary

Has anyone been able to get past the weird problem of the client seeing it as a dataset?

Tuesday, June 09, 2009 11:18 PM by Dustin

# re: XML Serializable Generic Dictionary

The client sees it as a dataset because the GetSchema method returns null. Null is the default proxy generator representation of a dataset.

Is there any way to return a valid schema here?

Thursday, June 11, 2009 10:55 AM by Djohnnie

# re: XML Serializable Generic Dictionary

I'm trying to set a property to this type in my Settings.settings file, but when I browse for types, my class is not listed. If I type in the namespace/class exactly, Visual Studio tells me it is not defined. However, if I manually edit the Settings.Designer.cs file with the SerializableDictonary type (instead of the type declared in the Settings.settings file), everything works like a charm. My problem is that any changes to the Settings.settings file re-generate the Settings.Designer.cs code, destroying my changes. Does anyone have any idea why this type is not showing up in the type browser in the Settings.settings file?

Thanks,

Mike

Wednesday, June 17, 2009 10:56 AM by Mike

# re: XML Serializable Generic Dictionary

hi there.

this is a nice solution for serializing Dictionaries. thanks. saved me lots of time.

Saturday, July 11, 2009 4:41 AM by venice

# re: XML Serializable Generic Dictionary

Paul,

Thanks so much for creating and posting this!  I ran into the serialization problem and immediately had visions of doing it by hand.  blah.  Your solution worked the first time!

Thursday, August 20, 2009 4:34 PM by Curt

# re: XML Serializable Generic Dictionary

I'm not sure why, but when using this to serialize to a string and working only with the XML fragment produced by this (i.e. a fragment of just the serialized dictionary, so <item> was the top-level element), I had to add two reader.EOF checks in ReadXml to avoid encountering the end of the file, like so:

   public void ReadXml(System.Xml.XmlReader reader)

   {

       XmlSerializer keySerializer = new XmlSerializer(typeof(TKey));

       XmlSerializer valueSerializer = new XmlSerializer(typeof(TValue));

       bool wasEmpty = reader.IsEmptyElement;

       reader.Read();

       if (wasEmpty)

           return;

       while (reader.NodeType != System.Xml.XmlNodeType.EndElement && !reader.EOF)

       {

           reader.ReadStartElement("item");

           reader.ReadStartElement("key");

           TKey key = (TKey)keySerializer.Deserialize(reader);

           reader.ReadEndElement();

           reader.ReadStartElement("value");

           TValue value = (TValue)valueSerializer.Deserialize(reader);

           reader.ReadEndElement();

           this.Add(key, value);

           reader.ReadEndElement();

           reader.MoveToContent();

       }

       if (!reader.EOF)

           reader.ReadEndElement();

   }

Saturday, September 12, 2009 4:19 PM by Richard

# re: XML Serializable Generic Dictionary

Hi ,

I have used this class in my web service and application. When i am calling my webservice using the following code

FacebookServiceSoapClient client = new FacebookServiceSoapClient("localhost/FacebookService.asmx");

           client.GenerateSignatureCompleted += ((sender, resultArg) =>

           {

               parameterList.Add("sig", resultArg.Result);

               ((FacebookServiceSoapClient)sender).CloseAsync();

               doThis(BuildQuery(parameterList));

           });

           client.GenerateSignatureAsync(parameterList);

The last line of code "  client.GenerateSignatureAsync(parameterList);

" gives me an error "cannot convert from  'SilverlightFacebook.SerializableDictionary<string,string>' to 'SilverlightFacebook.FacebookService.ArrayOfXElement'"

In the WebService i have the following method

[WebMethod]

       public string GenerateSignature(SerializableDictionary<string, string> parameters)

       {}

Please can someone help me with this

Wednesday, September 16, 2009 9:01 AM by Amit J R

# re: XML Serializable Generic Dictionary

Works great. Thanks!

Monday, September 28, 2009 5:39 PM by MIke K.

# Using Dictionary Object Params In Your Web Service

Using Dictionary Object Params In Your Web Service

Monday, October 12, 2009 10:13 AM by Kevin Grohoske

# Using Dictionary Object Params In Your Web Service

Using Dictionary Object Params In Your Web Service

Monday, October 12, 2009 10:19 AM by Kevin Grohoske

# re: XML Serializable Generic Dictionary

Thanks a lot it works fine for me

Tuesday, October 20, 2009 6:28 PM by Karim

# re: XML Serializable Generic Dictionary

HI pwelter34,

Great snippet.

Have a problem though. I have tried to create an SerializableDictionary inside another SerializableDictionary.

       private SerializableDictionary<EnumType1, SerializableDictionary<EnumType2, ObjectType>> _matrix;

This seems to fail. Please help.

Sundip

Monday, November 02, 2009 6:36 AM by Sundip

# re: XML Serializable Generic Dictionary

In order to work for the latest framework it is necesairy to have a root element.

in the WriteXML add a line

+49 writer.WriteStartElement( "dictionary" );

+70 writer.WriteEndElement( );

in the ReadXML add lines

+27 reader.ReadStartElement( "dictionary" );

+45 reader.ReadEndElement( );

Tuesday, November 03, 2009 6:09 AM by johannes

# re: XML Serializable Generic Dictionary

Ancak bir sorun var. Başka bir SerializableDictionary içinde bir SerializableDictionary oluşturmak için çalıştık.

Özel SerializableDictionary <EnumType1, SerializableDictionary <EnumType2,

Sunday, November 08, 2009 1:10 PM by ALTİNDAMLALAR.COM

# Culture-aware business objects

Culture-aware business objects

Thursday, November 12, 2009 12:44 PM by WIS3GUY.NET

# re: XML Serializable Generic Dictionary

çok güzel olmuş tbler

http://www.altindamlalar.com

Saturday, November 28, 2009 6:13 AM by DJ_AGLAMAZ@hotmail.com

# re: XML Serializable Generic Dictionary

your site is loading fast

Friday, December 11, 2009 7:33 PM by Suenthen

# re: XML Serializable Generic Dictionary

 any more posts coming ?

Wednesday, December 23, 2009 6:43 AM by Irish Peeps

# re: XML Serializable Generic Dictionary

thanks a very nice

Monday, January 04, 2010 2:39 AM by islami sohbet

# re: XML Serializable Generic Dictionary

Wednesday, January 06, 2010 6:03 AM by BIZBIZ20032003

# re: XML Serializable Generic Dictionary

Very nice script in XML. I will try it.

Thursday, January 07, 2010 10:31 AM by blacxcom

# re: XML Serializable Generic Dictionary

Thanks harita xml :)

Thursday, January 07, 2010 12:33 PM by islami sohbet

# re: XML Serializable Generic Dictionary

I,m getting an error in ReadXML at"

this.Add(key, value);

"An item with the same key has already been added"

This is in the first iteration.

"this" looks like its a completely filled (correctly)dictionary at this point in the debugging .

Sunday, January 17, 2010 11:41 AM by MikeP

# re: XML Serializable Generic Dictionary

Damn, that sound's so easy if you think about it.

# re: XML Serializable Generic Dictionary

Saturday, February 06, 2010 7:35 AM by zalim

# re: XML Serializable Generic Dictionary

в итоге: мне понравилось...  а82ч

Sunday, February 21, 2010 1:01 AM by Acinnina

# re: XML Serializable Generic Dictionary

в конце концов: превосходно!!  а82ч

Monday, February 22, 2010 12:30 PM by Acinnina

# re: XML Serializable Generic Dictionary

Sometimes it's really that simple, isn't it? I feel a little stupid for not thinking of this myself/earlier, though.

Monday, March 01, 2010 11:01 PM by ganar

# Dicationary Serialization

Pingback from  Dicationary Serialization

Thursday, March 04, 2010 9:36 AM by Dicationary Serialization

# Как сериализировать объект Dictionary

Для создания отчетов мне понадобилось представление объекта в XML формате. По рекомендации Краковецкого

Wednesday, March 17, 2010 3:34 PM by Разработка приложений

# re: XML Serializable Generic Dictionary

I think u need to include the zero argument constructor in order to make it work.

Thursday, March 18, 2010 6:45 AM by Longchrea

# re: XML Serializable Generic Dictionary

Great tip johannes! I was facing the same issue posted by Yury - weblogs.asp.net/.../444961.aspx.

Thanks once again.

Monday, March 22, 2010 6:07 AM by nlvraghavendra

# re: XML Serializable Generic Dictionary

Thank, very helpful

Ze

Friday, April 09, 2010 5:30 AM by Jose

# re: XML Serializable Generic Dictionary

Thanks for the code example. I got it working, but only after forcing the writer to push everything out: writer.Flush();

Thursday, April 15, 2010 10:43 AM by Tester

# re: XML Serializable Generic Dictionary

You're IOStrams (reader, writer) are not disposed!

Sunday, April 18, 2010 6:02 PM by Shimmy

# re: XML Serializable Generic Dictionary

The code helps me to serialize Generic Dictionary Items. Thanks for sharing.

Monday, April 26, 2010 5:21 AM by NHOQUE

# re: XML Serializable Generic Dictionary

Thanks a lot for your code but I have a problem with my class :

Public Class Person

   Inherits SerializableObject

   Implements SQL

   Private _id As Integer

   Private _lastname As String

   Private _firstname As String

   Private _attributes As SerializableDictionary(Of String, Object)

   Private _properties As SerializableDictionary(Of String, Object)

   Sub New()

       _id = -1

       _attributes = New SerializableDictionary(Of String, Object)

       _properties = New SerializableDictionary(Of String, Object)

   End Sub

   Sub New(ByVal Id As Integer)

       _id = Id

       _attributes = New SerializableDictionary(Of String, Object)

       _properties = New SerializableDictionary(Of String, Object)

   End Sub

   Sub New(ByVal Id As Integer, ByVal Lastname As String, ByVal Firstname As String, Optional ByVal attributes As Dictionary(Of String, Object) = Nothing, Optional ByVal properties As Dictionary(Of String, Object) = Nothing)

       _id = Id

       _lastname = Lastname

       _firstname = Firstname

       _attributes = New SerializableDictionary(Of String, Object)

       _properties = New SerializableDictionary(Of String, Object)

   End Sub

   Public ReadOnly Property ID() As Integer

       Get

           Return _id

       End Get

   End Property

   Public Property LastName() As String

       Get

           Return _lastname

       End Get

       Set(ByVal value As String)

           _lastname = value

       End Set

   End Property

   Public Property FirstName() As String

       Get

           Return _firstname

       End Get

       Set(ByVal value As String)

           _firstname = value

       End Set

   End Property

   Public Property Attributes() As SerializableDictionary(Of String, Object)

       Get

           Return _attributes

       End Get

       Set(ByVal value As SerializableDictionary(Of String, Object))

           _attributes = value

       End Set

   End Property

   Public Property Attribute(ByVal attributeKey As String) As Object

       Get

           Try

               Return _attributes.Item(attributeKey)

           Catch ex As Exception

               'TODO: Attribute GET - Process of log

               Return Nothing

           End Try

       End Get

       Set(ByVal value As Object)

           Try

               _attributes.Item(attributeKey) = value

           Catch ex As Exception

               'TODO: Attribute SET - Process of log

           End Try

       End Set

   End Property

   Public Property Properties() As SerializableDictionary(Of String, Object)

       Get

           Return _properties

       End Get

       Set(ByVal value As SerializableDictionary(Of String, Object))

           _properties = value

       End Set

   End Property

   Public Property [Property](ByVal propertyKey As String) As Object

       Get

           Try

               Return _properties.Item(propertyKey)

           Catch ex As Exception

               'TODO: [Property] GET - Process of log

               Return Nothing

           End Try

       End Get

       Set(ByVal value As Object)

           Try

               _properties.Item(propertyKey) = value

           Catch ex As Exception

               'TODO: [Property] SET - Process of log

           End Try

       End Set

   End Property

   ''' <summary>

   ''' Add a new attribute

   ''' </summary>

   ''' <param name="attributeKey">Key of the attribute</param>

   ''' <param name="value">Value of the attribute</param>

   Public Sub addAttribute(ByVal attributeKey As String, ByVal value As Object)

       Try

           _attributes.Add(New KeyValuePair(Of String, Object)(attributeKey, value))

       Catch ex As Exception

           'TODO: addAttribute - Process of log

       End Try

   End Sub

   ''' <summary>

   ''' Add a new property

   ''' </summary>

   ''' <param name="propertyKey">Key of the property</param>

   ''' <param name="value">Value of the property</param>

   Public Sub addProperty(ByVal propertyKey As String, ByVal value As Object)

       Try

           _properties.Add(New KeyValuePair(Of String, Object)(propertyKey, value))

       Catch ex As Exception

           'TODO: addProperty - Process of log

       End Try

   End Sub

   Public Function delete() As Boolean Implements SQL.delete

       'TODO: Add the method 'delete' on ADO Interface for Person Object

   End Function

   Public Function insert() As Boolean Implements SQL.insert

       'TODO: Add the method 'insert' on ADO Interface for Person Object

   End Function

   Public Function update() As Boolean Implements SQL.update

       'TODO: Add the method 'update' on ADO Interface for Person Object

   End Function

   Public Function saveObject() As Boolean

       Return Me.Save("Person " + ID.ToString + " (" + LastName + " " + FirstName + ").xml")

   End Function

   Public Overrides Function ToString() As String

       Return "Object Person #" + ID + " (" + LastName + " " + FirstName + ")"

   End Function

End Class

When I save my object, I have just this :

<?xml version="1.0" encoding="utf-16"?>

<Person xmlns:xsi="www.w3.org/.../XMLSchema-instance" xmlns:xsd="www.w3.org/.../XMLSchema">

 <LastName>Blossier</LastName>

 <FirstName>Yoann</FirstName>

 <Attributes />

 <Properties />

</Person>

Do you know why ? If you have any ideas, please help me.

Thursday, May 06, 2010 4:14 AM by Yoann

# Dwie rzeczy, kt??re warto wiedzie?? o serializacji w C# | Polishwords Blog

Pingback from  Dwie rzeczy, kt??re warto wiedzie?? o serializacji w C# | Polishwords Blog

# re: XML Serializable Generic Dictionary

In extension to Paul Welter's response on Monday, May 15, 2006 4:11 PM:

Ensure both types (TKey and TValue) are of type System.Xml.Serialization.IXmlSerializable, use the following class declaration syntax:

public class SerializableDictionary<TKey, TValue> : Dictionary<TKey, TValue>,

IXmlSerializable

where TKey : IXmlSerializable

where TValue : IXmlSerializable

{

 // ...

}

Monday, May 24, 2010 11:01 AM by Holger Boskugel

# Need a little help with Xml Serialization - Visual Basic .NET Forums

Pingback from  Need a little help with Xml Serialization - Visual Basic .NET Forums

# .Net Tips ??? Xml Serialize or Deserialize Dictionary in??C# | theburningmonk.com

Pingback from  .Net Tips ??? Xml Serialize or Deserialize Dictionary in??C# | theburningmonk.com

# SerializableDictionary &#8211; oder &#8220;Das muss doch irgendwie gehen&#8221; &raquo; &#8230;undsoweiterundsofort&#8230; - alles zwischen 0 und 1

Pingback from  SerializableDictionary &#8211; oder &#8220;Das muss doch irgendwie gehen&#8221; &raquo; &#8230;undsoweiterundsofort&#8230; - alles zwischen 0 und 1

# re: XML Serializable Generic Dictionary

Your code works well on the full framework but has a flaw on the compact framework. Supposed I have the following class containing 2 SerializableDictionary to be serialized:

public class AppConfig

{      

     public SerializableDictionary Dictionary1;

     public SerializableDictionary Dictionary2;    

}

The above code will result in an error: System.InvalidOperationException: Two mapping for dictionary.

The root cause of the error is at the first few lines of the SerializableDictionary source code:

[XmlRoot("dictionary")]

public class SerializableDictionary

   : Dictionary, IXmlSerializable

A workaround is not to define XmlRoot inside SerializableDictionary class, but to create another class inheriting from SerializableDictionary and define XmlRoot in that class.

See details at my blog minhdanh2002.blogspot.com/.../serializabledictionary-and.html

Saturday, June 19, 2010 10:57 PM by MD

# An XML-Serializable Generic Dictionary &laquo; CodeWords

Pingback from  An XML-Serializable Generic Dictionary &laquo; CodeWords

Monday, June 21, 2010 10:15 AM by An XML-Serializable Generic Dictionary « CodeWords

# Stupid .NET serialization tricks &laquo; Dan Newcome, blog

Pingback from  Stupid .NET serialization tricks &laquo;  Dan Newcome, blog

Thursday, July 08, 2010 3:07 PM by Stupid .NET serialization tricks « Dan Newcome, blog

# re: XML Serializable Generic Dictionary

SerializableDictionary is converted to dataset .... but the dataset is empty ....

How do I solve the problem....

Saturday, July 24, 2010 6:43 AM by Shruthi

# Comparing .NET XML Serializers: Part One&nbsp;|&nbsp;Technology Articles

Pingback from  Comparing .NET XML Serializers: Part One&nbsp;|&nbsp;Technology Articles

# re: XML Serializable Generic Dictionary

your blog is best man i loved it to read this post.

Monday, August 09, 2010 7:18 AM by cheap lion king tickets

# re: XML Serializable Generic Dictionary

Thanks! very useful

Tuesday, August 10, 2010 3:42 PM by Sohbet

# re: XML Serializable Generic Dictionary

Do you provide a license to your code? what kind of restrictions do you have on using your code for commercial purposes. Also the terms of use below points to Microsoft terms of use..Do you have copyrights on this code? Thanks

Thursday, August 26, 2010 11:57 AM by Aditya

# .NET XML serialization gotchas? ??? htmlcoderhelper.com

Pingback from  .NET XML serialization gotchas? ??? htmlcoderhelper.com

Saturday, August 28, 2010 10:24 AM by .NET XML serialization gotchas? ??? htmlcoderhelper.com

# re: XML Serializable Generic Dictionary

You saved my day Paul, god bless you!

Tuesday, August 31, 2010 4:58 AM by Apostolos Georgiadis

# re: XML Serializable Generic Dictionary

thanks a love admın day paul good

Tuesday, September 07, 2010 4:26 AM by video izle

# re: XML Serializable Generic Dictionary

Thanks  man,  it was very small and sweet explanation to understand this.  It really helped me, I had similar problem as MD, but now everything is working.  You people rocks

Monday, September 20, 2010 1:29 PM by dotnetguts

# XML Serialization f&uuml;r Dictionary | Christoph Hofmann

Pingback from  XML Serialization f&uuml;r Dictionary | Christoph Hofmann

Tuesday, September 28, 2010 1:17 PM by XML Serialization für Dictionary | Christoph Hofmann

# re: XML Serializable Generic Dictionary

The restaurants list with thousands of restaurants reviewed by visitors. restaurants-us.com/.../33065

Thursday, September 30, 2010 6:39 AM by TypeTalaneria

# re: XML Serializable Generic Dictionary

Thanks, this is exactly what I needed, I modded it slightly as I needed to serialize a SortedDictionary.

Thursday, October 07, 2010 8:24 AM by Matias

# re: XML Serializable Generic Dictionary

This is awesome news. A great way to greet the day.

Tuesday, October 19, 2010 6:46 AM by cheap rick ross tickets

# re: XML Serializable Generic Dictionary

looking for better and professional seo services, then please feel free to visit our website.

============================================================

Pallavi

<a href=“www.sapiencebpo.com”>seo services</a>

Tuesday, October 26, 2010 3:11 AM by seo services

# re: XML Serializable Generic Dictionary

thnx for sharing great article

Saturday, November 06, 2010 1:16 PM by Bulgaristanda Eğitim

# re: XML Serializable Generic Dictionary

Thanks! very useful...

Friday, November 12, 2010 5:04 AM by düzce haber

# ???NET???XML?????????????????? | IT??????????????????IT??????????????????

Pingback from  ???NET???XML?????????????????? | IT??????????????????IT??????????????????

# ????????????????????????????????????NET?????????????????????????????? | IT??????????????????IT??????????????????

Pingback from  ????????????????????????????????????NET?????????????????????????????? | IT??????????????????IT??????????????????

# Serialization Benchmarks | Monstersoft

Pingback from  Serialization Benchmarks | Monstersoft

Sunday, June 19, 2011 4:35 AM by Serialization Benchmarks | Monstersoft

# What is the most flexible serialization for .NET objects, yet simple to implement? - Programmers Goodies

Pingback from  What is the most flexible serialization for .NET objects, yet simple to implement? - Programmers Goodies

# serializable xml???????????????????????????????????????????????????????????????dictionary????????? | ????????????????????????

Pingback from  serializable xml???????????????????????????????????????????????????????????????dictionary????????? | ????????????????????????

# Writer welter | Imagestore

Pingback from  Writer welter | Imagestore

Saturday, July 23, 2011 12:10 AM by Writer welter | Imagestore

# welt-held.de &raquo; XML serialisierbares Dictionary&lt;TKey,TValue&gt;

Pingback from  welt-held.de &raquo; XML serialisierbares Dictionary&lt;TKey,TValue&gt;

# Dictionary nesnesi ile XmlSerialization &laquo; Ozan&#039;s blog

Pingback from  Dictionary nesnesi ile XmlSerialization &laquo; Ozan&#039;s blog

Tuesday, December 20, 2011 8:03 PM by Dictionary nesnesi ile XmlSerialization « Ozan's blog

# Dictionary ?? ???????????????????? ???????????????????????? | ?????????????? ????????????????????????

Pingback from  Dictionary ?? ???????????????????? ???????????????????????? | ?????????????? ????????????????????????

# Serializing Dictionaries to XML in C# &laquo; Stephen Curial&#039;s Blog

Pingback from  Serializing Dictionaries to XML in C# &laquo; Stephen Curial&#039;s Blog

Wednesday, January 25, 2012 12:41 PM by Serializing Dictionaries to XML in C# « Stephen Curial's Blog

# Tips For All

Pingback from  Tips For All

Friday, February 24, 2012 5:57 PM by Tips For All

# Tips For All

Pingback from  Tips For All

Saturday, February 25, 2012 12:06 PM by Tips For All

# Serializace do XML v C# | Jiri Tersel&#039;s Blog

Pingback from  Serializace do XML v C# | Jiri Tersel&#039;s Blog

Thursday, May 17, 2012 11:21 AM by Serializace do XML v C# | Jiri Tersel's Blog

# class cannot be serializied | PHP Developer Resource

Pingback from  class cannot be serializied | PHP Developer Resource

Wednesday, May 23, 2012 8:43 AM by class cannot be serializied | PHP Developer Resource

# XML Serializable Generic Dictionary &laquo; Du Sijun&#039;s Blog

Pingback from  XML Serializable Generic Dictionary &laquo; Du Sijun&#039;s Blog

Wednesday, August 01, 2012 6:27 AM by XML Serializable Generic Dictionary « Du Sijun's Blog

# Why does sgen require signing? | MSDN @ EEYOGO

Pingback from  Why does sgen require signing? | MSDN @ EEYOGO

Tuesday, October 16, 2012 4:27 AM by Why does sgen require signing? | MSDN @ EEYOGO

# Serialize Dot Net object which contains Dictionary object within Orchestration | MSDN @ EEYOGO

Pingback from  Serialize Dot Net object which contains Dictionary object within Orchestration | MSDN @ EEYOGO

# Christoph Hofmann &raquo; XML Serialization f??r Dictionary

Pingback from  Christoph Hofmann &raquo; XML Serialization f??r Dictionary

Monday, January 28, 2013 3:12 PM by Christoph Hofmann » XML Serialization f??r Dictionary

# Serializing lists with an object serializer

Pingback from  Serializing lists with an object serializer

Tuesday, March 19, 2013 9:14 PM by Serializing lists with an object serializer

# Serializing lists with an object serializer

Pingback from  Serializing lists with an object serializer

Tuesday, March 19, 2013 9:26 PM by Serializing lists with an object serializer

# Problems Serializing Object : Unlimitedtricks

Pingback from  Problems Serializing Object : Unlimitedtricks

Saturday, March 30, 2013 2:16 PM by Problems Serializing Object : Unlimitedtricks