Snippets

Here is your code snippet

Code


check if a file exists

check if a file exists

using System;
using System.IO;

namespace csharp
{
class Class1
{
static void Main(string[] args)
{

if(File.Exists(@"d:\lotto.txt"))
{
Console.WriteLine("File exists");
}
else
{
Console.WriteLine("Does not exist");
}

}
}
}