When I try to serialize the instance of class (which has List<KeyValuePair<string, dynamic>>
). I get error:
System.Runtime.Serialization.SerializationException: Unsupported type 'System.String' encountered. Perhaps you need to mark it [Serializable] or define a custom serializer for it?
When I make that List
as [NonSerialized]
all works okay.
What do you think about it. How can I fix it? I think this error because i have dynamic type.
This works for me.
Dictionary<string, dynamic> kvp = new Dictionary<string, dynamic>();
Not sure why you would use aList<KeyValuePair>
anyways.