Mono Class Library: System.IO Namespace

System.IO.DirectoryNotFoundException Class

Represents the error that occurs when part of a file or directory argument cannot be found. [Edit]

See Also: DirectoryNotFoundException Members

System.Object
     System.Exception
          System.SystemException
               System.IO.IOException
                    System.IO.DirectoryNotFoundException

[System.Runtime.InteropServices.ComVisible(true)]
public class DirectoryNotFoundException : IOException

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.

Remarks

Documentation for this section has not yet been entered. [Edit]

Example

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".

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0