title: Is it possible to pass parameters by reference with WCF
body: <p>I'm trying learn and use WCF but I'm confused on whether or not it is possible to pass parameters by reference. I struggled for a while trying to call an operation contract from my client that was passing a parameter by reference (it would timeout every time, even with both the service and client on my local machine). However the test client that Visual Studio provides could invoke the operation contract without problem (even with the reference parameter). My client succeeds when calling operation contracts that only contain value parameters however.</p>
  
  <p>I came across this article on MSDN but I must not be understanding it correctly because it seems to contradict itself (at least that's how I interpreted it): <a href="http://msdn.microsoft.com/en-us/library/ms733070%28v=vs.100%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms733070(v=vs.100).aspx</a></p>
  
  <p>under the heading <strong><em>"Parameters and Return Values"</em></strong> it states:</p>
  
  <blockquote>
    <p>Each operation has a return value and a parameter, even if these are
    void. However, unlike a local method, in which you can pass references
    to objects from one object to another, service operations do not pass
    references to objects. Instead, they pass copies of the objects.</p>
  </blockquote>
  
  <p>Yet further down under the heading <strong><em>"Out and Ref Parameters"</em></strong> it states:</p>
  
  <blockquote>
    <p>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.</p>
  </blockquote>
  
  <p>I'm using netTcpBinding with a .net client and (at least at this point) just trying to pass by reference a string. What am I missing? Is this possible?</p>
  
  <p><strong>UPDATE:</strong>
  It seems that if my operation contracts do not return a type (void/sub in c#/vb) then I can successfully pass parameters by reference (even multiple parameters). I'm guessing this is how it is designed as the reference parameters take the place of the return value in a request/reply operation.</p>