When your application is running you can lock it as :
using (FileStream fs =
File.Open("MyFilepath", FileMode.Open, FileAccess.Read, FileShare.None))
{
}
If you would like to have a permanent lock even when your application is not running :
You may think of Windows Service with the above code.