Re: I think C# is forcing us to write more (redundant) code
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Mon, 29 Aug 2005 18:21:38 +0100
Bob Powell [MVP] <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Creation and assignment of variables is essentially the same for VB and C#.
> Value types are assigned their normal default values. For example you don't
> have to explicitly write:
>
> int x = new int(12);
>
> and if you just use "int x;" then x contains zero.
>
> Reference types are assigned null by the framework too.
No, that's not true for local variables. Local variables aren't
assigned to anything by default, and can't be read until they've been
definitely assigned.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
.
- Follow-Ups:
- Re: I think C# is forcing us to write more (redundant) code
- From: Willy Denoyette [MVP]
- Re: I think C# is forcing us to write more (redundant) code
- References:
- I think C# is forcing us to write more (redundant) code
- From: Neo The One
- Re: I think C# is forcing us to write more (redundant) code
- From: Lasse Vågsæther Karlsen
- Re: I think C# is forcing us to write more (redundant) code
- From: Neo The One
- Re: I think C# is forcing us to write more (redundant) code
- From: Bob Powell [MVP]
- I think C# is forcing us to write more (redundant) code
- Prev by Date: Re: How to reference an event ?
- Next by Date: Re: How to set process name/description?
- Previous by thread: Re: I think C# is forcing us to write more (redundant) code
- Next by thread: Re: I think C# is forcing us to write more (redundant) code
- Index(es):
Relevant Pages
|
Loading