When is it appropriate to use the KnownType attribute?
[KnownType] is needed to tell it about subtypes. The disadvantage of not using it is that the following won’t work: [DataContract] class Foo {} [DataContract] class Bar : Foo {} with a method on the WCF interface that returns: public Foo GetFoo() { return new Bar(); } Without the attribute, the serializer (especially for mex/proxy-generated … Read more