Possible duplicate:Why is lock (this) {...} bad?
In C #, to make a critical area stream safe, we can use an operator lock(). The lock statement takes an object. What is wrong if we pass thislocks to the statement?
lock()
this
From http://msdn.microsoft.com/en-us/library/c5kehkcz.aspx :
In general, avoid blocking the public type or instances that go beyond your code. control. General designs lock (this), lock (typeof (MyType))and lock ("myLock")violate this manual:lock (this) , .lock (typeof (MyType)) - , MyType .lock("myLock") - , , , ., .
In general, avoid blocking the public type or instances that go beyond your code. control. General designs lock (this), lock (typeof (MyType))and lock ("myLock")violate this manual:
lock (this)
lock (typeof (MyType))
lock ("myLock")
MyType
lock("myLock")
, .
this , , . , this, . , , , , .
Source: https://habr.com/ru/post/1765339/More articles:PDF in modal iframe makes blank in IE - c #Problems with WebBrowser WPF - c #MKMapView iPhone annotation watchers can be selected once - iphonestreaming pdf data through an aspx page - c #LINQ to XML (Dynamic XML) - c #Drawing Inner Shadow Using CoreGraphics - iphoneCSS: Div does not apply to child divs - htmlgettext (gettext-commons) or stick with java i18n - internationalizationDisplay a PDF document on an ASP.net page - asp.netDeploying an application that contains a SQL Server database. What is the authentication method? - authenticationAll Articles