title: Field is member of a type which is serializable but is of type which is not serializable
body: <p>I'm developing a C# library with .NET Framework 4.7.</p>
  
  <p>I want to convert the class <code>ProductionOrderXmlFile</code> into a XML file:</p>
  
  <pre><code>[Serializable]
  public class Level
  {
      [XmlElement("Id")]
      public byte Id { get; set; }
      [XmlElement("Name")]
      public string Name { get; set; }
      [XmlElement("CodeType")]
      public byte CodeType { get; set; }
      [XmlElement("CodeSourceType")]
      public byte CodeSourceType { get; set; }
      [XmlElement("HelperCodeType")]
      public byte HelperCodeType { get; set; }
      [XmlElement("HelperCodeSourceType")]
      public byte HelperCodeSourceType { get; set; }
      [XmlElement("PkgRatio")]
      public int PkgRatio { get; set; }
  }
  
  [Serializable]
  public class VarData
  {
      [XmlElement("VariableDataId")]
      public string VariableDataId { get; set; }
      [XmlElement("LevelId")]
      public byte LevelId { get; set; }
      [XmlElement("Value")]
      public string Value { get; set; }
  }
  
  /// &lt;summary&gt;
  /// Class to load a production order from a xml file.
  /// &lt;/summary&gt;
  [Serializable, XmlRoot("root")]
  public class ProductionOrderXmlFile
  {
      [XmlElement("ProductionOrderName")]
      public string ProductionOrderName { get; set; }
      [XmlElement("NumItems")]
      public int NumItems { get; set; }
      [XmlElement("ProductCode")]
      public string ProductCode { get; set; }
      [XmlElement("Reduction")]
      public float Reduction { get; set; }
      [XmlArray("Levels")]
      [XmlArrayItem("Level")]
      public List&lt;Level&gt; Levels { get; set; }
      [XmlArray("VariableDatas")]
      [XmlArrayItem("VariableData")]
      public List&lt;VarData&gt; VariableData { get; set; }
  }
  </code></pre>
  
  <p>But in fields <code>public List&lt;Level&gt; Levels { get; set; }</code> and <code>public List&lt;VarData&gt; VariableData { get; set; }</code> I get the warning:</p>
  
  <p><strong>Warning   CA2235  Field Levels is a member of type ProductionOrderXmlFile which is serializable but is of type System.Collections.Generic.List which is not serializable</strong></p>
  
  <p>And:</p>
  
  <p><strong>Warning   CA2235  Field VariableData is a member of type ProductionOrderXmlFile which is serializable but is of type System.Collections.Generic.List which is not serializable</strong></p>
  
  <p>What do I need to do to avoid those warnings?</p>