title: How to call a generic c# web service from vb project
body: <p>Here is an example of my situation:</p>
  
  <p>C# generic function </p>
  
  <pre><code>public string Foo&lt;t&gt;(string test)
  {
     return test+test.ToString();
  }
  </code></pre>
  
  <p>VB</p>
  
  <pre><code>webservice.Foo(Of int, "Bar") 
  </code></pre>
  
  <p>///^This will error out saying 
  "has no type parameters and so cannot have type arguments"</p>
  
  <p>Normally when I call a type inferenced function in C# I do something like <code>Foo&lt;int&gt;()</code>. However I am unsure how to do it in VB. My searches haven't been fruitful. If someone could lead me where to search for a solution or help me, I would greatly appreciate it!   </p>
  
  <p><strong>---Update ----</strong></p>
  
  <p>After some more research I found out that you can't have a generic function in as a contract unless it's bounded. If you would like to know more you can click (<a href="https://stackoverflow.com/questions/10500870/serialize-generic-type-over-wcf-servicemarshaling%20rules%20for%20collections.">here</a>) Which says the following </p>
  
  <p>"You cannot define WCF contracts that rely on generic type parameters. Generics are specific to .NET, and using them would violate the service-oriented nature of WCF. However, a data contract can include a collection as a data member because WCF offers dedicated marshaling rules for collections." Sleiman</p>
  
  <p>&amp;</p>
  
  <p>"Sleiman is correct, but one can use Bounded Generics as described in <a href="http://jeffbarnes.net/blog/post/2007/05/10/WCF-Serialization-and-Generics.aspx" rel="nofollow noreferrer">this article</a>, and you may be able to achieve what you want. This allows you to create a generic type within the service and expose it. But the consumer will not view it as generic as the type is specified in the service operation." Idgorman.</p>