I’ve got the WCF web method M that returns the class A. The web method is configured to use the JSON serializer.
Now to the question: I’ve got the class B that is the immediate specialization of A. I want to return B, but the request fails if I do.
What do I need to do to make this work, if it’s even possible?
This is essentially my problem in scribbled code:
[WebMethod]
A M();
public A M() {
return new B(); // <-- no response on the client
}
[DataContract]
class A {
[DataMember]
bool Foo;
}
[DataContract]
class B : A {
}
The first thing to try would be: