SWR
✅ Is there a reason to still be using EventArgs and EventHandler<T> for events?
It's not necessary, no. It's just a windows conformance thing. The EventHandler delegate provides two things that can be very useful.
1. The object sender let's the event subscriber know who sent the event. You don't always need this. Sometimes you never need it, and sometimes the type could be guaranteed and defined, but including an object just covers every case.
2. The EventArgs is a base class. If someone decided to override some component class you made that contained events, and wanted to create a new event that internally triggered one of your events, they could do so and pass their derived event data if needed. If they needed to make a specialized EventArgs that held data and needed to pass it to one of your base events, this is possible because the base type is still EventArgs.
Events in C# are designed with an external subscriber in mind. We have no idea what they will use the event for, but we want to give them the option to do anything they need and not add any restrictions.
So yes, you can make an event of any delegate type, but it may hurt your scalability or subscribers to your events.
3 replies
❔ Improving performance for Process.Start
Without seeing your code, this is the best suggestion I can offer you
https://stackoverflow.com/questions/4291912/process-start-how-to-get-the-output
14 replies
❔ Is it efficient and worth doing?
For window interaction, C# doesn't add enough of a significant extra cost to warrant doing this. However, yes it is possible. If you're doing it for fun, go ahead, but the practicality of this is questionable, and I believe the technical debt to your app that you are introducing would be higher than the invisible gains you are receiving.
15 replies
❔ visual studio windows form app, how can i allow a panel to extend out of the form itsself?
This is a dumb question maybe, but what's wrong with the default behavior of a scroll bar in the combo box? This scales better than your idea. What happens when your combo box extends past your monitor?
58 replies