Was macht MethodImplOptions.Synchronized?
Was bedeutet MethodImplOptions.Synchronized
tun?
Ist der code unten
[MethodImpl(MethodImplOptions.Synchronized)]
public void Method()
{
MethodImpl();
}
entspricht
public void Method()
{
lock(this)
{
MethodImpl();
}
}
InformationsquelleAutor der Frage Amitabh | 2010-02-08
Du musst angemeldet sein, um einen Kommentar abzugeben.
Diese wurde beantwortet von Herr Jon Skeet auf einem anderen Website.
Zitat aus Post
Die post hat mehr Beispiel-code.
InformationsquelleAutor der Antwort David Basarab
Ja, es ist.
Sehen MethodImplOptions Enumeration
InformationsquelleAutor der Antwort Michael Stoll
Für statische Methoden ist es das gleiche wie:
http://social.msdn.microsoft.com/Forums/en-US/b6a72e00-d4cc-4f29-a6a0-b27551f78b9b/methodimploptionssynchronized-vs-lock
InformationsquelleAutor der Antwort Rico Suter