Can you use Generics with a web service?

Is it possible to have such a method in a WCF service contract and call it from a SOAP client?

TContentType GetTopics<TContentType>() where TContentType : ContentItem

I think generics are serializable, so maybe this only depends on whether the client supports them? Thoughts?

+3
source share
1 answer

No, the actual OperationContract should be about a specific type. You can get such a generic video, but not publish it directly.

You also cannot use overloading.

+3
source

Source: https://habr.com/ru/post/1787286/


All Articles