Is the code below
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
same as
public void Method()
{
lock(this)
{
MethodImpl();
}
}
Is the code below
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
same as
public void Method()
{
lock(this)
{
MethodImpl();
}
}
This was answered by Mr. Jon Skeet on another site.
Quote from Post
It's the equivalent to putting lock(this) round the whole method call.
The post has more example code.