I was looking at someone else’s WCF service contract and noticed it was using an out parameter:
client.SomeMethod(parameter1, parameter2, out someOutParameter);
Is there a good reason for having an out parameter instead of adding it to the response?
edit
This is what the proxy generated:
public string CreateItem(string contract, string note, out string warning)
Now if they needed to return a string and also have a warning, I have usually seen it like this:
public class CreateItemResponse
{
public string Result { get; set; }
public string Warning { get; set; }
}
I was just curious if there was a good reason for not doing it this way, and doing it with a string being returned and a string as an out parameter.
Not in a web service contract. Maybe laziness and unwillingness to define an additional data contract to be used as return type have been the driving forces behind this design decision.
out,refare .NET specific artifacts. A good and interoperable service contract shouldn’t rely on language specific artifacts.