See Also: DirectoryNotFoundException Members
System.Object
System.Exception
System.SystemException
System.IO.IOException
System.IO.DirectoryNotFoundException
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
Documentation for this section has not yet been entered.
The following example demonstrates an error that causes the System.IO.DirectoryNotFoundException exception to be thrown. In this case, the /Mistake/examples/ directory does not exist and therefore cannot be located.
C# Example
using System; using System.IO; class DirectoryNotFoundExample { public static void Main () { string badPath = "/Mistake/examples/"; try { Directory.GetFiles(badPath); } catch (DirectoryNotFoundException e) { Console.WriteLine("Caught: {0}",e.Message); } } }The output is
Caught: Could not find a part of the path "C:\Mistake\examples".
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0