Unless you have a really good reason for needing to implement IXmlSerializable, I would just use XmlSerializer and appropriate attributes on classes.
Based on the given XML example, this should do it. Note that I had to rename two of the attr attributes on manifest, because having multiple attributes with the same name is invalid.
using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
[Serializable]
[XmlRoot("manifest")]
public class Manifest
{
[XmlElement("list")]
public List<FeatureList> FeatureLists { get; set; }
[XmlAttribute("attr")]
public string Attr { get; set; }
[XmlAttribute("attr2")]
public string Attr2 { get; set; }
[XmlAttribute("attr3")]
public string Attr3 { get; set; }
}
[Serializable]
public class FeatureList
{
[XmlElement("feature")]
public List<Feature> Features { get; set; }
[XmlAttribute("name")]
public string Name { get; set; }
[XmlAttribute("attr")]
public string Attr { get; set; }
}
[Serializable]
public class Feature
{
[XmlAttribute("id")]
public string Id { get; set; }
[XmlAttribute("attr")]
public string Attr { get; set; }
}
Use the code like this:
var stream = ... // open the XML
var serializer = new XmlSerializer(typeof (Manifest));
var manifest = (Manifest) serializer.Deserialize(stream);