I wrote some code to get the files in a directory. In order to do this I used the Directory.GetFiles method. I’ve used it before, so I know it exists and works.
So I started using it (I’m using the System.IO namespace) and it tells me that ‘System.IO.Directory’ does not contain a definition for ‘GetFiles’. Indeed, if I use the intellisense, there is no such method. MSDN tells me that there is though, and I know I’ve used it before, and I’m 99% sure it was System.IO.Directory.
I do have System.IO.Directory… it just doesn’t have that method. It has methods like ‘GetCreationTime’, ‘GetDirectoryRoot’, ‘GetLastAccessTime’, ‘SetCurrentDirectory’ and so on, but no ‘GetFiles’.
Can anyone offer any help?
How are you making the call? That will tell us a lot about why the compiler might be complaining.
There are 3 Overloads for GetFiles on System.IO.Directory
Could you be looking for DirectoryInfo.GetFiles
The only 2 logical things I can think of that might cause this:
GetFileswas introduced in 2.0)