tags:

views:

39

answers:

2
+5  Q: 

WCF return types

What is the list of valid WCF return types? I know some but I want to know all of them:

  • Primitive types (string, int32, etc...)
  • Complex types with DataContract or Serializable attributes
  • Stream
  • Message
  • SyndicationFeedFormatter

void? POCOs?

+2  A: 

Basically everything that the serializer used in the binding could handle. Also note that since .NET 3.5 SP1 DataContract and DataMemeber are no longer necessary, WCF will serialize all public properties, but it is a good practice to put them.

Darin Dimitrov
A: 

Everything you stated. Everything Darin stated.

Plus...

Void is a valid return type. Wrapped in a (intentionally omitted) SOAP envelope:

<VoidResponse xmlns="http://tempuri.org/" />

POCOs with DataContracts and DataMembers are valid just like any other serializable object.

Maxime