title: datacontractserializer deserialize list<> always empty
body: <p>I'm deserializing data received from a web-service.</p>
  
  <p>The problem is that the deserialization of List returns an empty list and no exception are generated. Can you help me figure out why?
  We have tried several possible syntax. The code below is the closest to the correct solution but we cannot deserialize correctly as a list of classes.</p>
  
  <pre><code>&lt;ArrayOfBatch xmlns="http://schemas.datacontract.org/2004/07/myns" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"&gt;
  
  &lt;MaasBatch&gt;
  &lt;BatchName&gt;All Users&lt;/BatchName&gt;
  &lt;Users&gt;
  &lt;MaasUsers&gt;
      &lt;firstName&gt;bob&lt;/firstName&gt;
      &lt;lastName&gt;thetest&lt;/lastName&gt;        
      &lt;sourceEmail&gt;bob@source.com&lt;/sourceEmail&gt;
      &lt;sourceTenantID&gt;111&lt;/sourceTenantID&gt;
      &lt;targetEmail&gt;bob@target.com&lt;/targetEmail&gt;
      &lt;targetTenantID&gt;222&lt;/targetTenantID&gt;
  &lt;/MaasUsers&gt;
  &lt;/Users&gt;
  &lt;/MaasBatch&gt;
  &lt;/ArrayOfBatch&gt;
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code> List&lt;MAASBatch&gt; lstMaasBatches = null;
          try
          {                
              string target = string.Empty;
              using (var response = request.GetResponse())
              {
                  Stream streamReader = response.GetResponseStream();
                  DataContractSerializer serializer = new DataContractSerializer(typeof(List&lt;MAASBatch&gt;));
                  lstMaasBatches = (List&lt;MAASBatch&gt;)serializer.ReadObject(streamReader);
                  streamReader.Close();                   
              }
              return lstMaasBatches;
          }
          catch (Exception exc)
          {
              return lstMaasBatches;
          }    
  </code></pre>
  
  <p>Class:</p>
  
  <pre><code> [DataContract(Name = "MAASBatch", Namespace = "http://schemas.datacontract.org/2004/07/myns")]
  [KnownType(typeof(MAASUsers))]
  public class MAASBatch
  {
      [DataMember]
      public string BatchName { get; set; }
      [DataMember]
      public List&lt;MAASUsers&gt; Users { get; set; }
  
      [OnDeserializing]
      internal void OnDeserializingCallBack(StreamingContext streamingContext)
      {
          this.Users = new List&lt;MAASUsers&gt;();
      }
  }
  
  [DataContract(Name = "MAASUsers", Namespace = "http://schemas.datacontract.org/2004/07/myns")]    
  public class MAASUsers
  {
       [DataMember]
      public string firstName { get; set; }
       [DataMember]
      public string lastName { get; set; }
       [DataMember]
      public string sourceEmail { get; set; }
       [DataMember]
      public int sourceAgentID { get; set; }
       [DataMember]
      public string targetEmail { get; set; }
       [DataMember]
      public int targetAgentID { get; set; }
  
  }
  </code></pre>