I have class
public class IPTable : SerializableDictionary<string, string>
{
...
}
trying to deserialize IPTable
:
XmlSerializer serializer = new XmlSerializer(typeof(SerializableDictionary<string, string>));
StreamReader textReader = new StreamReader(xmlFileName);
SerializableDictionary<string, string> ip =( SerializableDictionary < string, string>) serializer.Deserialize(textReader);
return (IPTable)ip;
Got exception below while casting SerializableDictionary<string, string>
to IPTable
.
Message = "Unable to cast object of type 'SerializableDictionary`2[System.String,System.String]' to type 'IPTable'."
How to deserialize to IPTable
?