What should be the best practice to lock a block of code inside a console app, so that it doesn't create any problem while running multiple instances, of executable/application
string folder = Convert.ToString(ConfigurationManager.AppSettings["LogFilePath"]);
string configFile = Path.Combine(folder, "logger.xml");
FileStream fs = new FileStream(configFile, FileMode.Open);
log4net.Config.XmlConfigurator.Configure(fs);
fs.Close();