title: XML deserialization doesn't initialize an array element
body: <p>I am trying to deserialize the following XML:</p>
  
  <pre><code>&lt;ns0:L2CCustomer xmlns:ns0="http://CustomerSyncFromMDM_L2C.L2CCustomer_XML"&gt;
    &lt;customerList&gt;
      &lt;customer&gt;
        &lt;DNV_Status&gt;Active&lt;/DNV_Status&gt;
        &lt;MDM_ID&gt;1270004&lt;/MDM_ID&gt;
        &lt;fullName&gt;JONBER030&lt;/fullName&gt;
        &lt;AFFRowID&gt;1-GT6E0X&lt;/AFFRowID&gt;
        &lt;addressList&gt;
          &lt;address&gt;
            &lt;addrType&gt;Office&lt;/addrType&gt;
            &lt;addrStatus&gt;Active&lt;/addrStatus&gt;
            &lt;MDM_ID&gt;2090001&lt;/MDM_ID&gt;
            &lt;addrLine1&gt;Tårnveien 14&lt;/addrLine1&gt;
            &lt;addrLine2&gt;Buildling 2&lt;/addrLine2&gt;
            &lt;city&gt;Ås&lt;/city&gt;
            &lt;postalCode&gt;1430&lt;/postalCode&gt;
            &lt;country&gt;Norway&lt;/country&gt;
            &lt;validCountryISO2&gt;NO&lt;/validCountryISO2&gt;
            &lt;AFFRowID&gt;1-GT6E13&lt;/AFFRowID&gt;
          &lt;/address&gt;
        &lt;/addressList&gt;
      &lt;/customer&gt;
     &lt;/customerList&gt;
  &lt;/ns0:L2CCustomer&gt;
  </code></pre>
  
  <p>The code that I am using (T is of type AffinitasClientRoot):</p>
  
  <pre><code>System.IO.StreamReader r = new System.IO.StreamReader(m.BodyStream);
  string cze = r.ReadToEnd();
  var serializer = new System.Xml.Serialization.XmlSerializer(typeof(T));
  T result;
  using (System.IO.TextReader reader = new System.IO.StringReader(cze))
  {
      result = (T)serializer.Deserialize(reader);
  }            
  </code></pre>
  
  <p>The classes:</p>
  
  <pre><code>[Serializable]
  [XmlRoot(ElementName = "L2CCustomer", Namespace = "http://CustomerSyncFromMDM_L2C.L2CCustomer_XML")]
  [XmlType("L2CCustomer")]
  public class AffinitasClientRoot
  {
      [XmlArray("customerList")]
      [XmlArrayItem("customer")]
      public AffinitasClient[] Clients { get; set; }
  }
  
  [Serializable]
  [XmlRoot(ElementName = "customer")]
  [XmlType("customer")]
  public class AffinitasClient
  {
      [XmlElement(ElementName = "AFFRowID")]
      public string RowId { get; set; }
      [XmlElement(ElementName = "MDM_ID")]
      public string MdmId { get; set; }
      [XmlElement(ElementName = "fullName")]
      public string Name { get; set; }
      [XmlElement(ElementName = "DNV_Status")]
      public string Status { get; set; }
      public bool Active
      {
          get
          {
              return Status == "Active";
          }
      }
      [XmlArray("addressList")]
      [XmlArrayItem("address")]
      public AffinitasClientAddress[] Addresses { get; set; }
      [XmlElement(ElementName = "lastUpdatedByTimestamp")]
      public DateTime LastUpdateDate { get; set; }
      //[XmlElement(ElementName = "Updated")]
      //public DateTime LastUpdateDate { get; set; }
  }
  
  [Serializable]
  [XmlRoot(ElementName = "address")]
  [XmlType("address")]
  public class AffinitasClientAddress
  {
      [XmlElement(ElementName = "AFFRowID")]
      public string RowId { get; set; }
      [XmlElement(ElementName = "MDM_ID")]
      public string MdmId { get; set; }
      [XmlElement(ElementName = "addrType")]
      public string AddressType { get; set; }
      [XmlElement(ElementName = "addrStatus")]
      public string Status { get; set; }
      public bool Active
      {
          get
          {
              return Status == "Active";
          }
      }
      [XmlElement(ElementName = "addrLine1")]
      public string Address1 { get; set; }
      [XmlElement(ElementName = "addrLine2")]
      public string Address2 { get; set; }
      [XmlElement(ElementName = "city")]
      public string City { get; set; }
      [XmlElement(ElementName = "postalCode")]
      public string PostalCode { get; set; }
      [XmlElement(ElementName = "country")]
      public string Country { get; set; }
      [XmlElement(ElementName = "validCountryISO2")]
      public string CountryCode { get; set; }
      [XmlElement(ElementName = "lastUpdatedByTimestamp")]
      public DateTime LastUpdateDate { get; set; }
  }
  </code></pre>
  
  <p>The deserialization does not throw any exception, but the Clients array is null. Any ideas how I can solve it? I've been trying to do it for a few hours now and I cannot figure it out.</p>