Re: EventArgs
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Fri, 18 Apr 2008 12:47:01 -0700
On Fri, 18 Apr 2008 11:53:28 -0700, GiJeet <gijeet@xxxxxxxxx> wrote:
> I cannot imagine myself creating one type per each set of
parameters I need.
Why? What do you mean by this?
I can see the overhead for simple methods that only take one or two
parameters but I've seen methods with a dozen or so parameters and
it's a pain to keep them all straight when some get changed or removed
so there has to be a better way.
Your initial proposal was, and I quote: "why is this model not used for pass arguments to ALL methods".
No one is disagreeing that there are particular scenarios in which passing a class containing arguments can be beneficial.
Though, frankly...when you are getting up to a dozen parameters, that's a strong hint that there's something more fundamental wrong with the design. You can put a band-aid on it by wrapping the parameters in a class, or you can figure out why there are so many parameters and fix that underlying cause (for example, often this happens when there's some functionality that would have been much better incorporated into a helper class to do the work).
Pete
.
- References:
- EventArgs
- From: GiJeet
- Re: EventArgs
- From: Ignacio Machin ( .NET/ C# MVP )
- Re: EventArgs
- From: GiJeet
- EventArgs
- Prev by Date: Re: Compiler Error CS0702
- Next by Date: Re: Compiler Error CS0702
- Previous by thread: Re: EventArgs
- Next by thread: Re: EventArgs
- Index(es):