An interface collects only methods.
Since the XmlSerializer serializes only public fields and properties, the
XmlSerializer necessarily does not "do" interfaces.
Suppose your custom type has a public property that is ISomeInterface, if
the serializer peeked into that interface it would find no public fields or
methods; essentially there is no data attached to the interface. Therefore
it makes sense for nothing to be serialized there.
By serializing interfaces, what are you hoping to accomplish? what is your
goal?
If you want to serialize the state of an object, consider the binary
serializer.
-D
"Jack" <Ja**@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Did you ever get a reply to this question?
"axr" wrote:
Having trouble with Serilization of objects that contain members which
are of
type Interface
eg
public class SomeClass
{
ISomeInterface1 itf1;
ClassType1 ct1;
ISomeInterface2 itf2;
/**
// code
**/
}
itf1 and itf2 are instances of classes that implement the respective
interfaces.
The ClassType in turn may have other members that are of type interfaces.
While serializing this barfs with error "Cannot serialize xx because its
an
interface."
Any pointers on how to serialize this kind of an object?? (without
getting
rid of the interface members)