title: Cannot serialize parameter of type 'System.Linq.Enumerable... ' when using WCF, LINQ, JSON
body: <p>I have a WCF Service.  It uses Linq-to-objects to select from a Dictionary.  The object type is simple:</p>
  <pre><code>public class User 
  {
     public Guid Id;
     public String Name;
  }
  </code></pre>
  <p>There is a collection of these stored in a <code>Dictionary&lt;Guid,User&gt;</code>.</p>
  <p>I want to have a WCF <code>OperationContract</code> method like this:</p>
  <pre><code>public IEnumerable&lt;Guid&gt; GetAllUsers()
  {
      var selection = from user in list.Values
          select user.Id;
       return selection;
  }
  </code></pre>
  <p>It compiles fine, but when I run it I get:</p>
  <blockquote>
  <p>The server encountered an error processing the request. The exception message is 'Cannot serialize parameter of type 'System.Linq.Enumerable+WhereSelectEnumerableIterator<code>2[Cheeso.Samples.Webservices._2010.Jan.User,System.Guid]' (for operation 'GetAllUsers', contract 'IJsonService') because it is not the exact type 'System.Collections.Generic.IEnumerable</code>1[System.Guid]' in the method signature and is not in the known types collection. In order to serialize the parameter, add the type to the known types collection for the operation using ServiceKnownTypeAttribute.'. See server logs for more details.</p>
  </blockquote>
  <p>How can I coerce the selection to be an <code>IEnumerable&lt;Guid&gt;</code> ?</p>
  <hr />
  <p><strong>EDIT</strong><br />
  If I modify the code to do this, it works well - good interoperability.</p>
  <pre><code>public List&lt;Guid&gt; GetAllUsers()
  {
      var selection = from user in list.Values
          select user.Id;
       return new List&lt;Guid&gt;(selection);
  }
  </code></pre>
  <p>Is there a way for me to avoid the creation/instantiation of the <code>List&lt;T&gt;</code> ?</p>