C# Serialization of a List XML
<p>I am having an issue serializing a list of objects, in my case, a list of the Class type User. </p>

<pre><code>    [Serializable()]
    public class User 
    {
        string Fname { get; set; }
        string Lname { get; set; }
        string Address { get; set; }
        string City { get; set; }
        string State { get; set; }
        int Zip { get; set; }
        string Phone { get; set; }
        string Email { get; set; }

        public User(string f, string l, string a, string c, string s, int z, string p, string e)
        {
            Fname = f;
            Lname = l;
            Address = a;
            City = c;
            State = s;
            Zip = z;
            Phone = p;
            Email = e;
        }

        public User() { }
    }
</code></pre>

<p>The code I am trying to use to serialize the list to an XML file only produces an XML file with the name of the Class(User) and nothing else.</p>

<pre><code>{
    string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
    string fullpath = System.IO.Path.Combine(path, "Users.txt");
    Stream stream = File.OpenWrite(fullpath);
    XmlSerializer writer = new XmlSerializer(typeof(List&lt;User&gt;));

    writer.Serialize(stream, Users);
}
</code></pre>

<p>What exactly am I doing wrong here. Just to be clear, this is for homework. I am at a loss as to what to change to get the data stored into the file. Thanks.</p>