Thanks for your answer bud. Really appreciate
But unfortunately, I'm quite sure set it to null is not the same from remove a variable.
Unless the code below is wrong, change a variable to null just changes its value null. Don't remove the variable. To remove, you will have to manually remove it from the project.
project.GlobalVariables.SetVariable("namespace", "globVar1", null);
Testing. In the code below:
var gbVar = project.GlobalVariables["namespace", "globVar1"];
If the variable exists, the code will return true
If the variable do not exist, this code will raise an error.
Set the variable to null, in case it exists, won't change the above behavior. The variable will, still, exist in memory.
Why that was important to me:
If you are using that as a flag for threads in zennoposter, only the first time you run it you will know who the first thread is, because the above code will raise an error. So, after get the first thread you create the variable to the remains threads. They won't raise errors and you will know they aren't the first thread.
If you run it again you won't know who the first thread is, since the variable is already created and you can't remove it from memory with code, only if you delete the project from the poster manager or restart zennoposter
Take a look at this thread:
http://zennolab.com/discussion/threads/how-to-set-c-code-to-reset-globvar-to-0.21083/
It took me days trying all kind of solutions to overcome that. Then I realized that Globals are very unhandy and unstable. For me, it's better to sync important parts of the code with files.