See Also: FileNotFoundException Members
System.Object
System.Exception
System.SystemException
System.IO.IOException
System.IO.FileNotFoundException
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.FileNotFoundException exception to be thrown.
C# Example
using System; using System.IO; class FileNotFoundExample { public static void Main () { string badPath = "/Eccma/examples/FileTest.cs"; string goodPath = "/Ecma/examples2/FileTest.cs"; try { File.Copy(badPath,goodPath); } catch (FileNotFoundException e) { Console.WriteLine("Caught: {0}",e.Message); } } }The output is
Caught: Could not find file "/Eccma/examples/FileTest.cs".
Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0