Hi All, I was wondering, what is exactly the equivalent code to:
[MethodImpl(MethodImplOptions.Synchronized)] public void DoSomething() { /* Method code */ } Previous posts to this list have suggested that the equivalent is: public void DoSomething() { lock(this) { /* Method code */ } } If you look at the IL, you will see: .method public hidebysig instance void DoSomething() cil managed synchronized { } So the compiler does not just plant code. Could it be that the .NET runtime merely locks and unlocks before and after the method, without exception handling? Meaning, is the equivalent code more like: public void DoSomething() { Monitor.Enter(this); /* Method code */ Monitor.Exit(this); } Thanks, Juval. [EMAIL PROTECTED] IDesign Inc. .NET Design and Business Solutions http://www.idesign.net/ You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.