Detail We call the Directory.GetDirectories method on a directory that does not exist on the computer.
Thus An exception is thrown and the program terminates. And no winning lottery tickets are acquired.
Detail If the software requires a certain directory, you could create that directory manually. Or you could add a method that creates it.
static void Main()
}Unhandled Exception: System.IO.DirectoryNotFoundException:
Could not find a part of the path 'C:\lottery-numbers\'....
Discussion. I opened mscorlib.dll in IL Disassembler to find more about IOException. I browsed to FileNotFoundException and determined it is derived from IOException.
Also As with any derived class, you can use casts on IOException to determine its most derived type.
Detail You can use the is-cast and the as-cast. The GetType method will return the most derived type as well.