BCL mscorlib [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.5000.0 2.0.0.0 4.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.IO.IOException

Represents the error that occurs when a file path argument specifies a file that does not exist.

To be added.

The following example demonstrates an error that causes the exception to be thrown.

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

- Constructor

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance to a system-supplied message that describes the error, such as "Could not find the specified file." This message takes into account the current system culture.

  The and properties of the new instance are initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments.

  The and properties of the new instance are initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  An instance of that is the cause of the current exception. If is non-null, then the current Exception was raised in a catch block handling .

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments.

  The property of the new instance is initialized to .

  For more information on inner exceptions, see .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  A containing the name of the file that was not found.
  To be added.

  Constructs and initializes a new instance of the class.

  The constructor initializes the property of the new instance using and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments.

  The property of the new instance is initialized to .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Constructor
  A that describes the error. The content of is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture.
  The name of the file that was not found.
  An instance of that is the cause of the current exception. If is non-null, then the current Exception was raised in a catch block handling .
  To be added.

  Constructs and initializes a new instance of the class.

  This constructor initializes the property of the new instance using , the property using , and the property using . If is , the property is initialized to the system-supplied message provided by the constructor that takes no arguments.

  For more information on inner exceptions, see .

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String

  Gets the name of the file that cannot be found.

  A containing the name of the file, or if no file name was passed to the constructor for the current instance.

  This property is read-only.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Property
  System.String To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Method
  System.Void `` `` To be added. To be added. To be added. To be added. 1.0.5000.0 2.0.0.0 4.0.0.0
- Property
  System.String

  Gets the error message that explains the reason for the exception.

  A containing the error message. This string includes the if a value for that property was supplied to the constructor for the current instance.

  This property is read-only.

  0
  1.0.5000.0
  2.0.0.0
  4.0.0.0
- Method
  System.String

  Returns a representation of the current instance.

  A representation of the current Exception.

  The string representation returned by this method includes the fully qualified name of the current Exception, the message, the result of calling on the inner Exception, the file name, and the result of calling . Null values are omitted from the returned string.

  This method overrides .

  The following example causes a exception and displays the result of calling on that Exception.

  `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.ToString()); } } }`

  The output is

  `Caught: System.IO.FileNotFoundException: Could not find file "/Eccma/examples/FileTest.cs". File name: "/Eccma/examples/FileTest.cs" at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite) at FileNotFoundExample.Main()` 0 1.0.5000.0 2.0.0.0 4.0.0.0
0 System.Runtime.InteropServices.ComVisible(true)