I want to serial a hash table using the link
But I'm getting the error
Type 'WpfApplication3.MyHashtable' with the data contract name 'All mashashtable': 'Not expected. The list of known types is not known in any type of known type - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types near the DataContractSerializer.
My program is
Namespace WpfApplication3
thanks
Error getting because the line is happening:
SerializeToXmlAsFile (typef (hashtable), HT);
In your button 1_Click method, you are going through the Hashtable type DataContractSerializer constructor starts to serial itself to serialize the type of object you specify, in this case the hashtable Consequently, when you pass a type of MyIgatabat object when you call it
s.WriteObject (w, targetObject);
This does not know how to process it. To do this work, change what you have to do:
SerializeToXmlAsFile (typeof (MyHashtable), HT);
Comments
Post a Comment