且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当返回类型为 wcf 宁静服务中的泛型类型时,如何删除 xml 命名空间

更新时间:2023-02-20 11:17:26

You can do [DataContract(Name = "OperationResult")] 但实际上泛型在概念上不与想法混合RESTful 服务.

You can do [DataContract(Name = "OperationResult")] but really the generics conceptually don't mix will with the idea of RESTful services.

我建议创建一个新类,例如 class FacebookOperationResult : OperationResult{},然后将其用作您的返回类型.

I'd suggest creating a new class like class FacebookOperationResult : OperationResult<FacebookData> {} and then use that as your return type.