Re: Casting problem
- From: "tshad" <tfs@xxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2008 22:03:09 -0800
"Marc Gravell" <marc.gravell@xxxxxxxxx> wrote in message
news:fd6a60b4-76a9-4273-86ea-3cd8ce2deddd@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Sounds reasonable. If it costs more to put it together and even more toI like to consolidate where possible.
For the same reason to use anonymous functions (at least one of the
reasons).
Actually I'm all-up for anonymous methods for delegates; agree with
you strongly. Even better in C# 3 where you can use the much
abbreviated lambda syntax.
But there's a line smoewhere, between simpy consolidating, vs
deliberately banging your code out of shape to make it into one line/
statement; the fact that you have to ask how to do it in one statement
probably means you're on the far side of the line. It isn't helping
you, and it can *only* complicate the code. Fine if throwaway, but
most of the longterm cost of code is support/maintenance - which means
(in a typical corporate setupt) that you might not be the person
editing the code next time. If the next person has to stop and think
"what does this do?" then you've achieved an own goal; there are times
when simple code, and meaningful variable names go a long way towards
creating maintainable code.
maintain, then it probably wasn't the best way to go.
I haven't really done much with lambdas yet, but heard it was pretty neat.It could be that in some cases it is harder to follow by putting 2
anonymous
delegates in one method call. Not incorrect, just hard to follow.
I agree - not incorrect (see LINQ...) - but I would advocate using
lambdas if possible; they make such things a lot easier to follow;
regardless of the body of the anon/lambda, the human eye/brain can
only see so much at once; a lambda takes only a fraction as much
effort to understand as an anon-method.
Looking forward to playing with it.
Thanks,
Tom
Marc
.
- References:
- Casting problem
- From: tshad
- Re: Casting problem
- From: Marc Gravell
- Re: Casting problem
- From: tshad
- Re: Casting problem
- From: Marc Gravell
- Casting problem
- Prev by Date: dataAdapter InsertCommand problems
- Next by Date: Re: Exposing enums, properties and variables
- Previous by thread: Re: Casting problem
- Next by thread: Re: Casting problem
- Index(es):
Relevant Pages
|