> -----Original Message----- > From: Thomas Tomiczek [mailto:[EMAIL PROTECTED] > Sent: Wednesday, May 28, 2003 9:39 AM > To: [EMAIL PROTECTED] > > > -----Original Message----- > > From: brian.nantz [mailto:[EMAIL PROTECTED] > > Sent: Mittwoch, 28. Mai 2003 17:13 > > To: [EMAIL PROTECTED] > > > > First off I'm not sure why XMLSerialize can't handle > > interfaces. Isn't this kind of a bad restriction on a > > language that only has single inheritance and relies heavily > > on interfaces!???? > > How would the XmlSerializer deserialize the interface? What class would > you actually deserialize this into?
[Urs] Well it could do the same thing as it does for abstract classes, which work. An interface is logically not different from an abstract class. In go-mono they have it actually working, since I told them to fix it. It's pretty simple: at the time of the serialization there is an object, and if that object can be serialized it will. On de-serialization it can use the same mechanism as for abstract classes which cannot be instanciated as well. > > That said - I find a lot of the "limits" ot the XmlSerializer to be too > much. Seems the creators throught too much about a "round trip > experience", and not enough about "ceating a document from data > objects". If I have no intent to deserialize using the XmlSerializer, I > could actually serialize an interface. [Urs] Be more specific and make actual examples for your request, that will help MS to solve the problem. In the case of interfaces MS can take a peek at the mono implementation, if they can't figure it out themselves. > > > Here is my question. I have a barcode class that looks like this: > > > > public class Barcode : Control, IComponent { } > > > > When I try to xmlserialize it I get this error: > > > > System.NotSupportedException: Cannot serialize member > > System.ComponentModel.Component.Site of type > > System.ComponentModel.ISite because it is an interface. > > Yes :-) > > > If I override System.ComponentModel.Component.Site and tell > > Serialization to ignore it, it doesn't help. In fact if I > > comment out the IComponent from the class declaration it > > still compiles but with the same results. > > You can not comment it out - I would say that it is defined (publicly) a > level higher up in the class hierarchy, too. Propably the XmlSerializer > chokes there. The Isite is per definition part of the public interface > of your class. > > > This tells me that anything that implements IComponent or > > Inherits from Control can not be xml serialized? Surely I'm > > This seems to be the case. [Urs] You can implement another interface, I don't remember which one it is, to be serializable. - URS C. MUFF SOFTWARE ARCHITECT - RESEARCH LAB QUARK INC. [EMAIL PROTECTED] - X6360 +1 (303) 894 3360 CONFIDENTIALITY NOTICE This e-mail transmission and any documents, files, or previous e-mail messages appended or attached to it, may contain information that is confidential or legally privileged. If you are not the intended recipient, or a person responsible for delivering it to the intended recipient, you are hereby notified that you must not read this transmission and that any disclosure, copying, printing, distribution, or use of the information contained or attached to this transmission is STRICTLY PROHIBITED. If you have received this transmission in error, please immediately notify the sender by telephone +1 (303) 894-3360 or return e-mail message [EMAIL PROTECTED] and delete the original transmission, its attachments, and any copies without reading or saving in any manner. Thank you.