i have the following code:
using System;
using System.IO;
namespace Project
{
public partial class Documentation : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string[] filePaths = Directory.GetFiles(@"c:\MyDir\");
}
}
}
for some reason, i get the error “Project.Directory does not contain a definition for ‘GetFiles'”. If i change the namespace to anything else, the error goes away. Is there a way to find out what exactly I am doing in my current namespace that disallows the usage of the directory function?
You have defined your own class named
Directory. Instead, try specifyingAlternatively, you can specify a class alias for System.IO.Directory