In short:
it will not work because it requires boxing and boxing will create new object for reference in lock
every time code is executed so lock statement will not prevent anything.
Further read:
https://intellitect.com/blog/locking-a-block-of-code-with-an-integer/
One Reply to “Locking with integer”