March 2004
Intermediate to advanced
560 pages
26h 47m
English
using System;
using System.IO;
namespace Samples
{
public class FileNotFoundExceptionSample
{
public static void Main()
{
try
{
string s = "NotExists.txt";
using(FileStream fs = File.Open(s, FileMode.Open))
{
Console.WriteLine("File opened: {0}", s);
}
}
catch(FileNotFoundException e)
{
Console.WriteLine("Exception: {0}", e);
}
}
}
}
Exception: System.IO.FileNotFoundException: Could not find file "C:\Books\BCL\ Samples\System.IO\FileNotFoundException\NotExists.txt". File name: "C:\Books\BCL\Samples\System.IO\FileNotFoundException\NotExists.txt" at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean ...
Read now
Unlock full access