"directory" unknown--GHI sample

I am working with the GHI sample code (below), but get the following error:

Error 1 The name ‘Directory’ does not exist in the current context

What’s missing?

 static void RemovableMedia_Insert(object sender, MediaEventArgs e)
        {
            Debug.Print("Storage \"" + e.Volume.RootDirectory + 
                        "\" is inserted.");
            Debug.Print("Getting files and folders:");
            if (e.Volume.IsFormatted)
            { 
                string[] files = Directory.GetFiles(e.Volume.RootDirectory);
                string[] folders = Directory.GetDirectories(e.Volume.RootDirectory);
 
                Debug.Print("Files available on " + 
                            e.Volume.RootDirectory + ":");
                for (int i = 0; i < files.Length; i++)
                    Debug.Print(files[i]);
 
                Debug.Print("Folders available on " + 
                            e.Volume.RootDirectory + ":");
                for (int i = 0; i < folders.Length; i++)
                    Debug.Print(folders[i]);
            }

What line of code gives you this error?

You have posted this under general discussion but a specific context is necessary.

Is this standard MF API or Gadgeteer. What board are you using? Are you using MF 4.1 or 4.2 Beta?
Is this USB host or SD?

I guess I could search around and try to determine which GHI sample code you are referencing,
but that takes time. Might help if you repost your question under an appropriate forum and
give us a bit more info. At lease point us at the sample code.

May be an assembly missing: try System.IO

this is straight from the GHI mass storage tutorial (using a Cobra board) version 4.1.2821.0

GHI Electronics – Where Hardware Meets Software (near the very bottom of webpage)

system.io is already added (without it other errors appear, like persist storage)

the lines of code that say
string[] files = Directory.GetFiles(e.Volume.RootDirectory);
string[] folders = Directory.GetDirectories(e.Volume.RootDirectory);
giives the mentioned error

Please show your entire code in order for us to test it.

[quote]Please show your entire code in order for us to test it.
[/quote]

the rest of my (working) code is irrelevant…i pasted the example into my code & the indicated lines give an error…why

You do have using statement. Did you add the reference? Try also clean and build.

yes

system.io & its ref are added.

what DOES need added for Directory.G… to work

Error 1 The name ‘Directory’ does not exist in the current context

string[] files = Directory.GetFiles(e.Volume.RootDirectory);
string[] folders = Directory.GetDirectories(e.Volume.RootDirectory);

I already tried build many times…what is CLEAN?

There is a “Clean solution” command in Visual Studio.
It is a compile time error. If clean build wouldn’t help, try to recreate the project from scratch.

I tried a blank slate re-try & got the same result…

In desperation I selected the entire list of EVERY possible references & added them ALL to to project…after about 10 minutes of the computer grinding away, they were all added & the error is gone!!!

I found out that it was in SYSTEM.IO

I had added SPOT.IO

need better glasses…thanks for keeping me from giving up!