TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
david 0
NA
190
0
event keyword and accessors...
Aug 22 2004 11:03 AM
The devil is in the details.... Consider: public delegate void HandlerDelegate(int j); public HandlerDelegate e1; public event HandlerDelegate e2; public event HandlerDelegate e3 { add { e2 += value; } remove { e2 -= value; } } public event HandlerDelegate e4 { add { lock(this) {e2 += value; } } remove { lock(this) {e2 -= value; } } } e1 += new HandlerDelegate(f1); e2 += new HandlerDelegate(f1); e3 += new HandlerDelegate(f1); e4 += new HandlerDelegate(f1); The addition of the keyword "event" restricts usage to the += and -= operators, this is understood. The language specificaion indicates that e2 and e4 should produce equivilant code. This does not appear to be borne out by investigation of the disassembly!!!! Can anyone give a DEFINITIVE answer on the thread saftety of the four implementations as well as any other effects of using the keyword event {i.e. a comparision of e1 vs e2). I need an answer that can be confirmed. Thanks in advance! David V. Corbin Chief Software Architect Dynamic Concepts Development Corp. Sayville, NY
Reply
Answers (
0
)
stopping the same form from loading 2 times ?
Write XML data to existing document/tags