Pergunta

i am creating my first wcf service with webHttpBinding. On the net, i have read lot of articled telling that its bad practice to use out parameters with web services as described in

Is it bad practice to have an output parameter in a method in a WCF service?
Sometimes if we use out parameters in SOAP scenario. The client definition generated from wsdl changes the order of parameters as discussed here http://social.msdn.microsoft.com/Forums/en/wcf/thread/48b5992f-f7bd-4b67-8299-514d1780fa9a
what i have come to believe is that out parameters are impossible to work with in REST (webHttpBinding). Can anyone confirm or deny this?

Foi útil?

Solução

it's a bad practice to use out parameters at all in code. It makes code less readable and more error prone. You should always think about creating a returning object if you need more than 1 parameter back from a method. (in c# 4 you also can choose to return a tuple).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top