title: Optional parameter in UriTemplate in WCF
body: <p>I've used the hint in <a href="https://stackoverflow.com/questions/15289120/optional-uritemplate-parameter-using-webget">this thread</a> and provided a default value, so that when a user doesnät specify the virutal sub-directory, I'm making the assumption that he meant all the stuff to be listed. It works.</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(UriTemplate = "GetStuff/{type=all}", ...]
  IEnumerable&lt;Stuff&gt; GetStuff(String type);
  </code></pre>
  
  <p>However, it would be nicer to specify a default value, instead. However, <em>default(String)</em> is <em>null</em> and I'd like to sent in an actual value. Particularly, I've set my heart on <em>String.Empty</em>. However, I noticed that the following doesn't work. The condition on server side doesn't recognize the empty string (<em>...where 'type' in (ColName, '', 'all')</em>).</p>
  
  <pre><code>[OperationContract]
  [WebInvoke(UriTemplate = "GetStuff/{type=String.Empty}", ...]
  IEnumerable&lt;Stuff&gt; GetStuff(String type);
  </code></pre>
  
  <p>What to do?</p>