I am receiving a click event for a MenuItem in a Windows Forms app, but I'm using a generic handler for all MenuItem clicks and I need to dynamically determine the name of the particular MenuItem in question because I am using part of the name to embed metadata describing what the MenuItem is supposed to do.
Is there a way to do obtain a variable's name using reflection?
I suppose I could subclass MenuItem and add a field to store the information I'm trying to extract, but if I can avoid that I would like to.
Is there a way to do obtain a variable's name using reflection?
I suppose I could subclass MenuItem and add a field to store the information I'm trying to extract, but if I can avoid that I would like to.