It's interesting though if I use an unsafe code block with pointer or without
pointer access it is generally slower than the normal safe code blocks.
Are there any other optimizations like that .NET is doing, are they
documented anywhere? That could be very useful information to know.
Thanks,
Dave
[quoted text, click to view] "Paul Hill" wrote:
> "WXS" wrote:
>
> > I should point out when I tried to use properties of my own class I could not
> > reproduce this behavior, are arrays .Length field and other fields heavily
> > optimized even over constants???
> >
>
> No. What happens is for() loops that use Array.Length are special-cased to
> avoid bounds-checking on each access in the loop body, as the runtime can
> guarantee it's not out of bounds, which is something it can't do for the
> constant value.
>
> Hope this helps!