Re: C# 3.0 Proposals
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 23 May 2006 14:07:29 -0400
Demetri,
In reality, it is nothing like vb's variant type. For example, you can
not do this:
var stringVariable = "hello there";
var numberVariable = 0;
// This line throws a compiler error.
numberVariable = stringVariable;
As you pointed out in the section that you copied and pasted, it is an
^implicitly^ typed local variable. This doesn't mean that it is not strong
typed, it just means that it is not explicitly typed, like so:
string stringVariable = "hello there";
int numberVariable = 0;
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"Demetri" <Demetri@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3CB651CD-6B01-4CBD-922B-3CF0306236A5@xxxxxxxxxxxxxxxx
Where can I go to state my views for or against some of the C# 3.0
proposals?
They are listed here:
http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/CSharp_3.0_Specification.doc
For one thing, I can not believe they are trying to convert C# to VB by
making it a non-type safe language. For an example of what I mean read
this
excerpt from the doc:
"26.1 Implicitly typed local variables
In an implicitly typed local variable declaration, the type of the local
variable being declared is inferred from the expression used to initialize
the variable. When a local variable declaration specifies var as the type
and
no type named var is in scope, the declaration is an implicitly typed
local
variable declaration. For example:
var i = 5;
var s = "Hello";
var d = 1.0;
var numbers = new int[] {1, 2, 3};
var orders = new Dictionary<int,Order>();"
I don't know about you guys, but that just smells too much like VB's
variant
type. NASTY!!
--
-Demetri
.
- Follow-Ups:
- Re: C# 3.0 Proposals
- From: Demetri
- Re: C# 3.0 Proposals
- Prev by Date: Re: C# 3.0 Proposals
- Next by Date: Re: using Excel 2003 from C# 2003
- Previous by thread: Re: C# 3.0 Proposals
- Next by thread: Re: C# 3.0 Proposals
- Index(es):
Relevant Pages
|