class can not do serialization without empty constructor
<p>I wonder why a <code>class</code> can not do <code>serialization</code> without empty constructor.</p>

<p>I tried it a few times when I got this error message:</p>

<pre><code>ClassName cannot be serialized because it does not have a parameterless constructor.
</code></pre>

<p>The code goes like this:</p>

<pre><code>   public void DoSerialize(string path)
    {
        try
        {
            XmlSerializer serializer = new XmlSerializer(typeof(List&lt;MyClass&gt;));
            TextWriter textWriter = new StreamWriter(path);
            serializer.Serialize(textWriter, MyList);
            textWriter.Close();
        }
        catch (Exception e)
        {

        }
    }
</code></pre>

<p>Really, when I added an empty constructor it worked</p>
