C
ckkwan
Hi C# gurus,
In MFC, we have a CSingleLock class, which will ensure that a mutex is
unlocked by itself when the CSingleLock object goes out of scope (when
the distructor is been invoked).
Yes, in C# we can do that using lock {}
But my question is, if I need to do something similar, where I need to
ensure that when my function goes out of scope something is invoked
automatically (regardless of whether I return or an unexpected
exception been thrown). How can I do that in C#?
TIA.
In MFC, we have a CSingleLock class, which will ensure that a mutex is
unlocked by itself when the CSingleLock object goes out of scope (when
the distructor is been invoked).
Yes, in C# we can do that using lock {}
But my question is, if I need to do something similar, where I need to
ensure that when my function goes out of scope something is invoked
automatically (regardless of whether I return or an unexpected
exception been thrown). How can I do that in C#?
TIA.

