I want to lock few lines of code based on a flag from App config. So based on that flag I run the application asynchronously or not. So i need to lock execution of few lines of code by checking the flag. So i need to write code repetitive. Below is the sample
if (flag) {
lock(dataLock){
//few lines of code
}
} else {
//repeat the above code gain here (few lines of code)
}
Is there any alternative way where I can save my repeated codes.
Aucun commentaire:
Enregistrer un commentaire