Overloading Stack.Push?
<p>I'm trying to add FileInfo details to my xml file by recursively scanning and collecting the files.  However, i'm having a bit of trouble and i'm not quite sure how to resolve this issue.</p>

<p>Here's my code:</p>

<pre><code>public static class ScanAndSerialize
{
    public static void Serialize()
    {
        List&lt;string&gt; dirs = FileHelper.GetFilesRecursive(@"s:\project\");


        XmlSerializer SerializeObj = new XmlSerializer(dirs.GetType());
        string sDay = DateTime.Now.ToString("MMdd");
        string fileName = string.Format(@"s:\project\{0}_file.xml", sDay);
        TextWriter WriteFileStream = new StreamWriter(fileName);
        SerializeObj.Serialize(WriteFileStream, dirs);
        WriteFileStream.Close();


    }
}

static class FileHelper
{
    public static List&lt;string&gt; GetFilesRecursive(string b)
    {
        List&lt;string&gt; result = new List&lt;string&gt;();

        Stack&lt;string&gt; stack = new Stack&lt;string&gt;();
        stack.Push(b);

        while (stack.Count &gt; 0)
        {
            string dir = stack.Pop();

            try
            {
                result.AddRange(Directory.GetFiles(dir, "*.*"));


                foreach (string dn in Directory.GetDirectories(dir))
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(@"s:\project\");
                    dirInfo.Name.ToString();
                    dirInfo.Attributes.ToString();
                    dirInfo.CreationTime.ToString();
                    dirInfo.Exists.ToString();
                    dirInfo.LastAccessTime.ToString();
                    dirInfo.LastWriteTime.ToString();

                    stack.Push(dn);                    

                }


            }
            catch
            {

            }
        }
        return result;




    }

}
</code></pre>

<p>}</p>

<p>Ok where i run into an error is where I'm trying to take the dirInfo.Name.ToString() and the other lines of code and somehow incorporate those into rendering my XML file with these details.  The error is that Push cannot be overloaded as i tried:</p>

<pre><code>stack.Push(dn, dirInfo.Name.ToString(), dirInfo.Attributes.ToString().....)
</code></pre>

<p>Anybody have any ideas?  Am i doing this backwards?</p>
