I come from a VB.Net
environment, where using Imports System
and then IO.Directory.GetFiles(...)
works.
On the other hand, it seems that using System;
is not sufficient to write use IO.Directory
without prefixing it with System.
. The only workaround seems to be
using IO = System.IO;
Why?
Example code:
using System;
using System.IO;
namespace Test {
class Program {
static void Main(string[] args) {
System.Console.WriteLine(IO.Directory.GetFiles(System.Environment.CurrentDirectory)[0]);
}
}
}
Edit: My question is not what should I do to get my code working, but specifically "why cant I write IO.Directory.GetFiles
??"