问题
From the MSDN:
Parameters sourceArray
The Array that contains the data to copy. destinationArray
The Array that receives the data. length
A 64-bit integer that represents the number of elements to copy. The integer must be between zero and Int32.MaxValue, inclusive
Given that the permitted range of values is 0
to Int32.MaxValue
, what is the motivation for adding this signature? It did not exist in .Net 1.0 and was only added in .Net 1.1. My only guess is to prepare for 64-bit Framework implementations.
回答1:
Curiously an array also has overloads for GetItem that take either an Int32 and an Int64. But in practice you cannot have a single object larger than 2 gigabytes in the current implementation of the .NET framework so you can't actually create an array that allows such large indexes.
I guess if this restriction were lifted later then it would mean that they don't need to change the interface.
来源:https://stackoverflow.com/questions/3764725/why-does-array-copy-support-long-arguments