Click here to Skip to main content
15,895,084 members
Home / Discussions / C#
   

C#

 
GeneralRe: Video Editing Component? Pin
Tony Archer10-May-04 16:29
Tony Archer10-May-04 16:29 
GeneralRe: Video Editing Component? Pin
osto10-May-04 16:54
osto10-May-04 16:54 
GeneralRe: Video Editing Component? Pin
Kolich11-May-04 1:09
Kolich11-May-04 1:09 
GeneralRe: Video Editing Component? Pin
Tony Archer11-May-04 8:20
Tony Archer11-May-04 8:20 
GeneralRe: Video Editing Component? Pin
leppie11-May-04 7:18
leppie11-May-04 7:18 
GeneralRe: Video Editing Component? Pin
Tony Archer12-May-04 0:31
Tony Archer12-May-04 0:31 
QuestionHow Know if an control has added an event Pin
machocr10-May-04 10:12
machocr10-May-04 10:12 
AnswerRe: How Know if an control has added an event Pin
Heath Stewart10-May-04 10:41
protectorHeath Stewart10-May-04 10:41 
You can either declare your own add and remove accessors for your event (like the get and set accessors for properties), or use a collection or dictionary with events for when objects have been added or removed. If you want to do something like this for a control's events, you should override them like so:
public event Click
{
  add
  {
    if (value.Target is IMyInterface)
      base.Click += value;
  }
  remove { base.Click -= value; }
}
This would allow you to selectively allow event handlers to be added to an event. If you wanted, you could create an event on this subclass that you would fire from these accessors when a delegate (event handler) is added or removed.

If you're just looking for a way to determine if an event handler is added to or removed from and event without going through these steps, I really don't see how that's possible without using some sort of profiler, which is definitely not an easy task.

Although, that does bring up another way, though this really would work for controls. You could use a context-bound object and intercept the event add and remove calls using aspect-oriented programming techniques.

 

Microsoft MVP, Visual C#
My Articles
GeneralSending data over POST Pin
CWIZO10-May-04 9:21
CWIZO10-May-04 9:21 
GeneralRe: Sending data over POST Pin
Heath Stewart10-May-04 9:45
protectorHeath Stewart10-May-04 9:45 
GeneralRe: Sending data over POST Pin
CWIZO10-May-04 10:24
CWIZO10-May-04 10:24 
GeneralRe: Sending data over POST Pin
Heath Stewart10-May-04 10:46
protectorHeath Stewart10-May-04 10:46 
GeneralDropDownList - Behavioral Question. Pin
stan2810-May-04 7:43
stan2810-May-04 7:43 
GeneralRe: DropDownList - Behavioral Question. Pin
Heath Stewart10-May-04 9:03
protectorHeath Stewart10-May-04 9:03 
Generaltoolbar icon Pin
elena1234510-May-04 6:16
elena1234510-May-04 6:16 
GeneralRe: toolbar icon Pin
Heath Stewart10-May-04 6:49
protectorHeath Stewart10-May-04 6:49 
GeneralRe: toolbar icon Pin
elena1234510-May-04 10:08
elena1234510-May-04 10:08 
GeneralRe: toolbar icon Pin
Heath Stewart10-May-04 10:44
protectorHeath Stewart10-May-04 10:44 
GeneralDatabase Wrapper Pin
JohnMess10-May-04 5:25
sussJohnMess10-May-04 5:25 
GeneralRe: Database Wrapper Pin
Heath Stewart10-May-04 5:40
protectorHeath Stewart10-May-04 5:40 
GeneralRe: Database Wrapper Pin
johnmess10-May-04 6:31
sussjohnmess10-May-04 6:31 
QuestionImage retrieval from ImageList is slow? Pin
Judah Gabriel Himango10-May-04 4:39
sponsorJudah Gabriel Himango10-May-04 4:39 
AnswerRe: Image retrieval from ImageList is slow? Pin
Heath Stewart10-May-04 4:47
protectorHeath Stewart10-May-04 4:47 
GeneralRe: Image retrieval from ImageList is slow? Pin
Judah Gabriel Himango10-May-04 4:53
sponsorJudah Gabriel Himango10-May-04 4:53 
GeneralRe: Image retrieval from ImageList is slow? Pin
Judah Gabriel Himango10-May-04 6:19
sponsorJudah Gabriel Himango10-May-04 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.