whenever i try to serialize the dictionary i get the exception:
System.ArgumentException: Type
\'System.Collections.Generic.Dictionary`2[[Foo.DictionarySerializ
I know it's late, but maybe someone else can make use of it in the future. You can achieve what you need using LINQ:
Dictionary data = new Dictionary();
data.Add(TestEnum.A, 1);
data.Add(TestEnum.B, 2);
data.Add(TestEnum.C, 3);
JavaScriptSerializer serializer = new JavaScriptSerializer();
Dictionary dataToSerialize = data.Keys.ToDictionary(p => p.ToString(), p => data[p]);
string dataSerialized = serializer.Serialize(dataToSerialize);