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 o开发者_高级运维r Serializable attributes
- Stream
- Message
- SyndicationFeedFormatter
void? POCOs?
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.
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.
精彩评论