Re: For vs. For Each

From: Your_name (dfd_at_dkjdsf.com)
Date: 08/11/04


Date: Wed, 11 Aug 2004 15:13:49 GMT


"Gabriele G. Ponti" <ggponti.at.hotmail.com> wrote in
news:#CcNh$6fEHA.2812@tk2msftngp13.phx.gbl:

> Anders Hejlsberg: "Generally my answer is, Always use FOR EACH if you
> can, because chances are you will have fewer bugs if you use FOR EACH.
> There are just more pitfalls with the regular FOR statement. It is
> true that in some cases the FOR statement is more efficient. I think
> the vast majority of cases, I don’t think you would ever notice. My
> advice would be, always use FOR EACH profile your app. If they turn
> out to be your problem, then change them to FOR statements, but I
> don’t think you ever will in real code. I think FOR EACH is much more
> expressive, and in theory allows us to optimize your code more in the
> future. There are certain optimizations that we will do, because we
> can tell that you’re going over the entire collection or whatever, and
> so we could, at least in theory, generate even better code. I would
> highly recommend FOR EACH unless you really do need the index."
>
> http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20040624c
> sharpah/manifest.xml
>
>

The big man has spoken, end of discussion :D



Relevant Pages

  • Re: For vs. For Each
    ... "Gabriele G. Ponti" wrote in ... because chances are you will have fewer bugs if you use FOR EACH. ... > There are just more pitfalls with the regular FOR statement. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: For vs. For Each
    ... "Gabriele G. Ponti" wrote in ... because chances are you will have fewer bugs if you use FOR EACH. ... > There are just more pitfalls with the regular FOR statement. ...
    (microsoft.public.dotnet.framework)
  • Re: For vs. For Each
    ... "Gabriele G. Ponti" wrote in ... because chances are you will have fewer bugs if you use FOR EACH. ... > There are just more pitfalls with the regular FOR statement. ...
    (microsoft.public.dotnet.general)
  • Re: Writing portable applications
    ... > previously stated, Sturgeon's law applies to the web, so chances are ... > The only difference is that the user of Platform 54 has a chance to ... it may not work because that platforms bugs are ... >> vendor refuses to fix a bug and ask THEM to ask that vendor. ...
    (comp.unix.programmer)