David Rougier

David Rougier

  • NA
  • 8
  • 4.4k

Event Delegate Unreachable

Apr 10 2011 11:09 AM
Hi everyone,

I tried to create and handle an event in C# for the first time but I met a problem.

I declared an event delegate in a static class called ArchiveurPerfsBJ.
Here the declaration :

public

I have implemented a callback method in the static class containing the main method. The class is called EntreeConsole.

Here is the prototype of the callback method :

private

I have written a statement to affect the callback method to the delegate as I read in a C# book. Unfortunately, the statement generates an error before execution. Here is the statement :

ArchiveurPerfsBJ

The error description informs me that ArchiveurPerfsBJ.VNoteArchive (i.e. The event delegate) is unreachable because of its protection level.

I don't know how to solve this problem so I have posted this message to get some help.

.VNoteArchive += ArchiveurPerfsBJ_VNoteArchive;
static void ArchiveurPerfsBJ_VNoteArchive(object emetteur, VNoteArchiveEventArgs arguments) {...}
static event EventHandler<VNoteArchiveEventArgs> VNoteArchive;

Answers (4)