How to accept a collection of a base type in WCF
问题 The Setup I have a WCF service that exposes a base type (e.g. Animal) as well as a few derived types (e.g. Lion, Tiger, and Bear). Another type (e.g. Zoo) includes a property that is a collection of the base type. The base type is concrete, not abstract, so it is perfectly acceptable for the collection to contain instances of the base type and/or the derived types (in any combination). For example: [DataContract, KnownType(typeof(Lion)), KnownType(typeof(Tiger)), KnownType(typeof(Bear))]