Examples

Jul 11, 2010 at 2:04 AM

Could you please post some more examples? I am having trouble getting my head wrapped around how to use these abstractions. I would specifically like to see some examples of using the DirectoryInfoWrapper and the FileInfoWrapper.

Thanks!

May 8, 2013 at 8:59 PM
Edited May 8, 2013 at 9:00 PM
Here is a quick example.
public class FileInstall
{
    private IFileSystem IO;

    public FileInstall(IFileSystem fileSystem)
    {
        this.IO = fileSystem;
    }

    public void DoStuff()
    {
        Console.Clear();
        
        Console.WriteLine(IO.Directory.GetCurrentDirectory());
        Console.WriteLine();

        string[] files = IO.Directory.GetFiles(@"C:\Temp", "*.*");
        foreach (string file in files)
        {
            Console.WriteLine(file);
        }
    }
}