Re: foreach doesn't work with array of bools?
From: Mattias Sjögren (mattias.dont.want.spam_at_mvps.org)
Date: 08/04/04
- Next message: fred: "what are assembly evidence made for ?"
- Previous message: Yves Dhondt: "Open diskpartition"
- In reply to: Joe Rattz: "foreach doesn't work with array of bools?"
- Next in thread: Nicholas Paldino [.NET/C# MVP]: "Re: foreach doesn't work with array of bools?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 04 Aug 2004 17:40:53 +0200
Joe,
>What is going on?
Exactly what the compiler says. The variable in a foreach statement is
read only.
>Also, the array of bools seems to have intialized to false anyway. Can I
>count on that?
Yes you can. When you create a new array, all elements have their
default initial value. For bool, that's false.
>Should I even worry about initializing them?
I wouldn't waste CPU cycles on it.
Mattias
-- Mattias Sjögren [MVP] mattias @ mvps.org http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com Please reply only to the newsgroup.
- Next message: fred: "what are assembly evidence made for ?"
- Previous message: Yves Dhondt: "Open diskpartition"
- In reply to: Joe Rattz: "foreach doesn't work with array of bools?"
- Next in thread: Nicholas Paldino [.NET/C# MVP]: "Re: foreach doesn't work with array of bools?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|