Events or Lambdas in C#? -
I'm throwing it as a question of curiosity ...
Believing that you are only wishing to provide a method , can it be worried or bad behavior?
Public classes some {public activity onmodiv = () = & gt; {}; Public action & lt; Object, EventArgS & gt; On-finishing = (Sender, E) = & gt; {}; } // was used then ... something. Onvero = () => { /*do something...*/ }; Some.Onfildloading = (Sender, E) = & gt; { /*do something else...*/ }; I know that it is like cheating on events, but am I bad about this approach? Will it continue any issues with your application for a long time?
I know that you want to run more than one method, then an event will be better, this is mainly a question if you want only one way / expecting Are there.
Okay, the most obvious thing to talk about is "wrong" It is exposed that I want to use at least one property - at which point an event will probably be as simple as it gives more flexibility with less code than a property (because you have a specific default value Can not use an automatically applied property).
The second option must be taken in the constructor and then it should be kept as a private read only field. It is probably that what I really want to do ... is there any need to expose the action in the form of a property / territory?
Comments
Post a Comment