In the following code
var Directory_02 = "TEST_01";
DirectoryInfo directory2 = new DirectoryInfo(Directory_02);
directory2.Create();
if (directory2.Exists)
{
System.Console.WriteLine("{0} exists: {1}", Directory_02, directory2.Exists);
directory2.Delete();
System.Console.WriteLine("{0} exists: {1}", Directory_02, directory2.Exists);
}
We have the output
TEST_01 exists: True
TEST_01 exists: True
Why when directory2.Delete()
is called directory2.Exists
continues true
?