C# opening each textfile and reading all text issue
<pre><code>{
        DirectoryInfo dinfo = new DirectoryInfo(@"C:\Documents and Settings\g\Desktop\123");
        FileInfo[] Files = dinfo.GetFiles("*.txt");
        foreach (FileInfo filex in Files)
        {
            string contents = File.ReadAllText(filex);
            string sharename = Regex.Match(contents, @"\Share+(\S*)(.)(.*)(.)").Groups[2].Value;
        }
    }
</code></pre>

<p>I just want to be able to open each textfile in this directory, read it all, and then pull the regex i have listed,  With this code can someone point out where my brain fart is?</p>

<p>The best overloaded method match for 'System.IO.File.FileInfo' to 'string' has some invalid arguments
Argument '1' cannot convert frm System.IO.FileInfo to string</p>
