Q: Serializing fields of an IEnumerable class to XML I am trying to serialize the following classes.
[XmlRoot("SerializableThing")]
public class SerializableThing : IEnumerable<SubThing>
{
    public List<SubThing> SubThings = new List<SubThing>();

    [XmlElement]
    public string Id { get; set; }

    public void Add(SubThing sub)
    {
        SubThings.Add(sub);
    }

    public IEnumerator<SubThing> GetEnumerator()
    {
        return SubThings.GetEnumerator();
    }

    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}

public class SubThing
{
    public string SubId;
}

Serialization code (pretty vanilla):
static void Main(string[] args)
{
    SerializableThing main = new SerializableThing();
    SubThing sub = new SubThing();

    main.Id = "hiiiii";
    sub.SubId = "hello";

    main.Add(sub);

    SaveXML(main, new XmlSerializer(typeof(SerializableThing)), "hi.xml");
}

static void SaveXML(object data, XmlSerializer serializer, string xmlPath)
{
    using (Stream stream = File.Create(xmlPath))
    using (XmlWriter writer = XmlWriter.Create(stream)) {
        writer.WriteStartDocument();
        serializer.Serialize(writer, data);
        writer.WriteEndDocument();
    }
}

Now, the output is this. Notice that it is the enumerable (List<SubThing>) and not an instance of SerializableThing.
<SerializableThing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SubThing>
    <SubId>hello</SubId>
  </SubThing>
</SerializableThing>

The goal is to get Id to be serialized. Can I trick the serializer into treating SerializableThing as an essentially normal class with a list as a property?
