How can I know the ACTUAL maximum number of elements a .net array of a given type can be allocated?
问题 I know that all arrays in .net are limited to 2 GB, under this premise, I try not to allocate more that n = ((2^31) - 1) / 8 doubles in an array. Nevertheless, that number of elements still doesn't seem to be valid. Anyone knows how can I determine at run time the maximum number of elements given sizeof(T)? I know that whatever quantity approaching that number is just a lot of elements but, for all intents and purposes, let's say I need it. Note: I'm in a 64-bit environment, with a target