P
Peter Duniho
This is kind of a question about C# and kind of one about the framework.
Hopefully, there's an answer in there somewhere.
I'm curious about the status of 32-bit vs 64-bit in C# and the framework
classes. The specific example I'm running into is with respect to byte
arrays and the BitConverter class. In C# you can create arrays larger than
2^32, using the overloaded methods that take 64-bit parameters. But as near
as I can tell, the BitConverter class can only address up to a 32-bit offset
within the array.
I see similar issues in other areas. The actual framework classes (of which
the Array class itself is one, if I understand things correctly, and thus an
exception to this generality) don't all seem to provide full 64-bit support,
even though the C# language does (through specific overloads to .NET classes
that form built-in language elements).
I suppose one workaround in this example would be to copy the interesting
parts of the array to a smaller one that can be indexed by BitConverter with
its 32-bit parameters. But not every situation is resolvable with such a
simple workaround. For example, if one is displaying an array in a
scrollable control and wants to set the scrollbar to something in the same
order of magnitude as the array length itself, this is not possible because
the scrollbar controls use only 32-bit values.
Am I missing something? Is there a general paradigm that addresses these
sorts of gaps between things that can be 64-bit and things that cannot? Or
is this just par for the course with respect to being in a transition period
between the "old" 32-bit world and the "new" 64-bit world?
Having already made it through the transitions from 8-bit to 16-bit, and
from 16-bit to 32-bit, I guess I was sort of hoping we'd have learned our
lesson and gotten a little better at this. But I'm worried that's not the
case. I'm hopeful someone can reassure me.
Thanks,
Pete
Hopefully, there's an answer in there somewhere.

I'm curious about the status of 32-bit vs 64-bit in C# and the framework
classes. The specific example I'm running into is with respect to byte
arrays and the BitConverter class. In C# you can create arrays larger than
2^32, using the overloaded methods that take 64-bit parameters. But as near
as I can tell, the BitConverter class can only address up to a 32-bit offset
within the array.
I see similar issues in other areas. The actual framework classes (of which
the Array class itself is one, if I understand things correctly, and thus an
exception to this generality) don't all seem to provide full 64-bit support,
even though the C# language does (through specific overloads to .NET classes
that form built-in language elements).
I suppose one workaround in this example would be to copy the interesting
parts of the array to a smaller one that can be indexed by BitConverter with
its 32-bit parameters. But not every situation is resolvable with such a
simple workaround. For example, if one is displaying an array in a
scrollable control and wants to set the scrollbar to something in the same
order of magnitude as the array length itself, this is not possible because
the scrollbar controls use only 32-bit values.
Am I missing something? Is there a general paradigm that addresses these
sorts of gaps between things that can be 64-bit and things that cannot? Or
is this just par for the course with respect to being in a transition period
between the "old" 32-bit world and the "new" 64-bit world?
Having already made it through the transitions from 8-bit to 16-bit, and
from 16-bit to 32-bit, I guess I was sort of hoping we'd have learned our
lesson and gotten a little better at this. But I'm worried that's not the
case. I'm hopeful someone can reassure me.

Thanks,
Pete