.NET (C#) events - custom EventArgs question -


I have several C # custom events that are associated with the items selected in a tree, and then a context menu selected items Some triggers on the trigger I started building a separate EventArgs-based class for each custom event, to package the data needed for this event.

Although in the previous view, I have realized that most of my custom event (probably all) must be given a list of the underlying items presented by at least the tree selection.

Keeping this in mind, I wonder if any of the following is an acceptable practice?

  • Use same custom events for many events; RGS-based classes (they only require an object list) Obviously, it should work, but some events from naming conventions It appears to break which event is used for machinery wires.

  • Create a base class that is often needed by the object list, and then get additional classes because additional data is required.

  • Maybe something else completely?

Currently, I only have some custom events, but need to add more. Since I look at a pattern emerging in relation to the data required for each event, I have a better plan before continuing.

Thanks for any advice.

I was done before this road I went with my second idea of ​​keeping a base event class That wraps up common data. If an event will not use it directly, then make the Base Class Internal to avoid unnecessary items from the users. Due to the base class, you are allowed to add more event data in later times. Since the classroom is internal, users are unaffected from outside changes.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -