What does MethodImplOptions.Synchronized do?
Is the code below
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
equivalent to
public void Method()
{
lock(this)
{
MethodImpl();
}
}
What does MethodImplOptions.Synchronized do?
Is the code below
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
equivalent to
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.