InterviewSolution
Saved Bookmarks
| 1. |
How to check whether a file exist in C#? |
|
Answer» C# already provides Exists() method to CHECK the existence of a file in a directory. LET us see the code in C# USING System; using System.IO; public class Example { public static void Main() { if (File.Exists(@"C:\jacob.txt")) { Console.WriteLine("File do exist!"); } ELSE { Console.WriteLine("File does not exist!"); } } } |
|