Is there any way to lock on an integer in C#? Integers can not be used with lock because they are boxed (and lock only locks on references).
The scenario is as follo
You should use a sync object like this:
public class YourForm { private static object syncObject = new object(); public void Moderate() { lock(syncObject) { // do your business } } }
But this approach shouldn't be used in a web app scenario.