Are 'by ref' arguments in WCF bad or good?

MatteoSp picture MatteoSp · Dec 24, 2009 · Viewed 10.5k times · Source

I've recently seen a WCF service declaring operation contracts with by ref arguments.

I don't know why this design decision was taken (operations are void), but furthermore, I'm not able - from my WCF knowledge - to say if this is a good practice or not. Or if this is not relevant.

What do you think?

Answer

HainesyP picture HainesyP · Jul 15, 2010

However, According to this Microsoft Article a WCF Call behaves exactly like a Remote Procedure Call and ByRef arguments can be used to return data:-

http://msdn.microsoft.com/en-us/library/ms733070.aspx

Refer to the section: Out and Ref Parameters

In most cases, you can use in parameters (ByVal in Visual Basic) and out and ref parameters (ByRef in Visual Basic). Because both out and ref parameters indicate that data is returned from an operation, an operation signature such as the following specifies that a request/reply operation is required even though the operation signature returns void.