How can I control the name of generic WCF return types?

后端 未结 3 2081
遇见更好的自我
遇见更好的自我 2020-12-06 02:39

I\'ve got a WCF Web Service method whose prototype is:

[OperationContract]
Response> GetCustomers();

When I add

3条回答
  •  醉梦人生
    2020-12-06 03:30

    You can define your own name in the DataContract attribute like this:

    [DataContract(Name = "ResponseOf{0}")]
    public class Response
    

    Note that in your example the {0} will be replaced and your proxy reference type will be ResponseOfArrayOfCustomer.

    More info here: WCF: Serialization and Generics

提交回复
热议问题