creatiive
asked on
"Cannot serialize because it is an interface." exception message.
Hi,
I am trying to DE-serialize an object, but when i attempt to do so, i get the error: "Cannot serialize member 'items' of type 'ImyItem' because it is an interface. The class member it is referring to is ;
public List<ImyItem> items {
get { return this._items; }
set { this._items = value; }
}
the interface 'ImyItem' defines the member variables and a few methods for the 'my'Item' objects. Why am i getting this error on deserialization? The code to deserialize that i am using is;
System.IO.StreamReader sr = new System.IO.StreamReader(ope nFileDialo g1.FileNam e);
XmlSerializer ser = new XmlSerializer(typeof(WS.My Class));
MyClass ob = (MyClass)ser.Deserialize(s r);
System.console.writeline(o b.name.tos tring());
sr.Close();
Any help with this would be greatly appriciated!!
I am trying to DE-serialize an object, but when i attempt to do so, i get the error: "Cannot serialize member 'items' of type 'ImyItem' because it is an interface. The class member it is referring to is ;
public List<ImyItem> items {
get { return this._items; }
set { this._items = value; }
}
the interface 'ImyItem' defines the member variables and a few methods for the 'my'Item' objects. Why am i getting this error on deserialization? The code to deserialize that i am using is;
System.IO.StreamReader sr = new System.IO.StreamReader(ope
XmlSerializer ser = new XmlSerializer(typeof(WS.My
MyClass ob = (MyClass)ser.Deserialize(s
System.console.writeline(o
sr.Close();
Any help with this would be greatly appriciated!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If possibe, you should serialise the contrete class that underlies then ImyItem to get it to work.
J