On Mon, Jul 27, 2009 at 12:59 PM, Cerebrus<[email protected]> wrote:
>
> 2. I would use the members of the System.IO namespace instead of
> relying on string splitting. I would do it like this:
>
And I would use the members of the System.IO.Path namespace instead of
relying on string building. :)
Instead of:
private DirectoryInfo GetExtension(FileInfo file)
{
string ext = file.Extension.Replace(".", "");
return CreateDir(this.path + "\\" + ext);
}
I would do something closer to:
private DirectoryInfo GetExtension(FileInfo file)
{
string ext = file.Extension.Replace(".", "");
return CreateDir(System.IO.Path.Combine(this.path, ext));
}
Check out
ms-help://MS.VSCC.v90/MS.MSDNQTR.v90.en/dv_fxfund/html/bf00c380-706a-4e38-b829-454a480629fc.htm
-- it's full of tricks!