jeudi 2 décembre 2021

How to know if Invoke was called in C#

I have an event Action Event in my code.

where I put many events there like this:

  public class TheClass 
  {
        public static Action Event;
    
        public TheClass() {
            // dummy example but many others methods could be registerd here 
            //even outside this class because it is static
            TheClass.Event += myMethod;
        }
    
        public void myMethod() {
            // dummy example
        }

        public void DoInvokeTest() {
            Event.Invoke(); // here I'd like to know if my method was invoked and by who
        }
}

How to know if myMethod was called and by who on Even.Invoke()





Aucun commentaire:

Enregistrer un commentaire