title: XmlAttribute/XmlText cannot be used to encode complex types
body: <p>I am getting the following error on the below class:</p>
  
  <p>Cannot serialize member 'Ingredient' of type DataObjects.Ingredient. XmlAttribute/XmlText cannot be used to encode complex types.</p>
  
  <p>Any thoughts as to why?</p>
  
  <pre><code>[DataContract]
  [Serializable]
  [XmlRoot("ingredient")]
  public class Ingredient
  {
      private string id;
      private string name;
      private string description;
  
      private IngredientNutrient[] nutrients;
  
      public Ingredient(string id, string name, string description, IngredientNutrient[] nutrients)
      {
          this.id = id;
          this.name = name;
          this.description = description;
          this.nutrients = nutrients;
      }
  
      public Ingredient(string id, string name, string description)
      {
          this.id = id;
          this.name = name;
          this.description = description;
      }
  
      public Ingredient()
      {
  
      }
  
      [DataMember]
      [XmlAttribute("id")]
      public string ID
      {
          get { return this.id; }
          set { this.id = value; }
      }
  
      [DataMember]
      [XmlAttribute("name")]
      public string Name
      {
          get { return this.name; }
          set { this.name = value; }
      }
  
      [DataMember]
      [XmlAttribute("description")]
      public string Description
      {
          get { return this.description; }
          set { this.description = value; }
      }
  
      [DataMember]
      [XmlArray("nutrients")]
      [XmlArrayItem("ingredientnutrient")]
      public IngredientNutrient[] Nutrients
      {
          get { return this.nutrients; }
          set { this.nutrients = value; }
      }
  
  }
  </code></pre>