title: Do WCF and DataContractSerializer serialize CollectionDataContract-decorated collection types differently?
body: <p>I have a really simple customized collection type that inherits from List&lt;> and uses a CollectionDataContract.  </p>
  
  <p>When I use DataContractSerializer.WriteObject to serialize it, it respects the CollectionDataContract attribute the way I'd expect; however, when I use it as a return type for a WCF method, I get the default ArrayOfFoo.</p>
  
  <p>I'm wondering if there is some decoration I'm missing in the service contract.</p>
  
  <p>Details:</p>
  
  <pre><code>[DataContract(Namespace = "")]
  public class Foo
  {
      [DataMember]
      public string BarString { get; set; }
  }
  
  [CollectionDataContract(Namespace = "")]
  [Serializable]
  public class FooList : List&lt;Foo&gt; {}
  </code></pre>
  
  <p>If I just instantiate a Foo and then use DataContractSerializer.WriteObject to serialize it, I get what you'd expect:</p>
  
  <pre><code>&lt;FooList&gt;
      &lt;Foo&gt;
          &lt;BarString&gt;myString1&lt;/BarString&gt;
      &lt;/Foo&gt;
  &lt;/FooList&gt;
  </code></pre>
  
  <p>However, if I have a service with a method like this...</p>
  
  <pre><code>[ServiceContract Name = "MyService"]
  public interface IMyService
  {
      [OperationContract, WebGet(UriTemplate = "foos/")]
      FooList GetAllFoos();
  }
  </code></pre>
  
  <p>and then do a GET for <a href="http://www.someEndpoint.com/foos/" rel="noreferrer">http://www.someEndpoint.com/foos/</a>, I get this:</p>
  
  <pre><code>&lt;ArrayOfFoo&gt;
      &lt;Foo&gt;
          &lt;BarString&gt;myString1&lt;/BarString&gt;
      &lt;/Foo&gt;
  &lt;/ArrayOfFoo&gt;
  </code></pre>
  
  <p>I've also tried specifying Name="MyFooListName" in the CollectionDataContract attribute.  Same results: DataContractSerializer gets the memo; WCF doesn't.</p>