Re: simple example
- From: "Patrice" <http://scribe-en.blogspot.com/>
- Date: Wed, 16 Sep 2009 19:44:12 +0200
This is it !
Error 1 A local variable named 'x' cannot be declared in this scope
because it would give a different meaning to 'x', which is already used
in a 'parent or current' scope to denote something else
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 322 14
ConsoleApplication1
This is what you get up to 2.0 (1.0 not tested ;-))
and NOT what you might expect
Error 1 The name 'x' does not exist in the current context
F:\C#\ConsoleApplication1\ConsoleApplication1\Program.cs 321 40
ConsoleApplication1
Rather than this one, with 3.5, you have "Cannot use local variable 'x'
before it is declared. The declaration of the local variable hides the field
'ConsoleApplication1.Foo.x'." which looks much closer to what you expect and
is basically correct...
So it looks messages are improved in the 3.5 compiler. Prior 3.5 I agree
that the error message is totally misleading...
So, it's really best to always mention the version you are using when it is
not current. You may want to upgrade to 3.5 (the compiler is updated but if
you don't use new 3.5 libraires, you can benefit from new language
constructs as the underlying generated IL code still targets the 2.0 CLR).
--
Patrice
.
- Follow-Ups:
- Re: simple example
- From: Tony Johansson
- Re: simple example
- References:
- simple example
- From: Tony Johansson
- Re: simple example
- From: Alberto Poblacion
- Re: simple example
- From: Patrice
- Re: simple example
- From: Tony Johansson
- Re: simple example
- From: Patrice
- Re: simple example
- From: Tony Johansson
- Re: simple example
- From: Patrice
- simple example
- Prev by Date: Re: Search through a (large) binary file.
- Next by Date: Re: possible for FileStream lock not released on close ?
- Previous by thread: Re: simple example
- Next by thread: Re: simple example
- Index(es):
Relevant Pages
|