Skip to content

Commit d14a132

Browse files
authored
Remove unnecessary and wrong locking code (#760)
Fixes dotnet/docs#6472 Note: The second comment about registering `OnDraw`if `PreDrawEvent` is emtpy is not correct. The code works as checked in.
1 parent 7cf5858 commit d14a132

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

snippets/csharp/VS_Snippets_VBCSharp/csrefKeywordsContextual/CS/csrefKeywordsContextual.cs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,30 +225,16 @@ class TestClass : global::TestApp { }
225225
}
226226

227227

228-
//<Snippet15>
229-
228+
//<Snippet15>
230229
class Events : IDrawingObject
231230
{
232231
event EventHandler PreDrawEvent;
233232

234233
event EventHandler IDrawingObject.OnDraw
235234
{
236-
add
237-
{
238-
lock (PreDrawEvent)
239-
{
240-
PreDrawEvent += value;
241-
}
242-
}
243-
remove
244-
{
245-
lock (PreDrawEvent)
246-
{
247-
PreDrawEvent -= value;
248-
}
249-
}
235+
add => PreDrawEvent += value;
236+
remove => PreDrawEvent -= value;
250237
}
251-
252238
}
253239
//</Snippet15>
254240
interface IDrawingObject

0 commit comments

Comments
 (0)