Re: question on anonymous type
- From: Arne Vajhøj <arne@xxxxxxxxxx>
- Date: Fri, 06 Jun 2008 23:15:40 -0400
Jon Skeet [C# MVP] wrote:
Arne Vajhøj <arne@xxxxxxxxxx> wrote:If people ignore the C#-specific features of C# 3 just because they're not used to them, they'll be really missing out.If the only think they miss out is stuff like this that has no
functional impact, then they will survive.
I'm sure they'll survive - they just may not be as productive.
I doubt it.
It has been discussed as a new feature for Java and it is nowhere
near the top of the popularity list.
The problem with redundancy isn't the possibility for inconsistency - it's the lack of information density. It takes more space redundantly specifying information, so there's more to wade through when reading the code.The possibility of inconsistency is the classic reason to avoid
redundancy.
In many other scenarios, yes. Not here.
Disk space is cheap.
Who was arguing that disk space was relevant?
You said that it takes more space.
And I find it hard to believe that the usage of var instead of
explicit classname should take longer time to read.
It changes the emphasis of the code. Eric Lippert puts it well:
http://csharpindepth.com/ViewNote.aspx?NoteID=61
I think it is the other way around.
X o = new X();
emphasizes the what and not the how.
First you read that you have an o of type X.
Then you may or may not read where you got it from.
var o = new X();
First you read that you have an o without more info and
then you has to read where it came from to figure out what
it is.
Arne
.
- Follow-Ups:
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- References:
- question on anonymous type
- From: timor . super
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- Re: question on anonymous type
- From: Arne Vajhøj
- Re: question on anonymous type
- From: Jon Skeet [C# MVP]
- question on anonymous type
- Prev by Date: Re: question on anonymous type
- Next by Date: Re: Using Reflection to Dynamically Determine Stored Procedure Name
- Previous by thread: Re: question on anonymous type
- Next by thread: Re: question on anonymous type
- Index(es):
Loading