It is impossible to create a one-dimensional array having more than 2,147,483,591 elements (for comparison, int.MaxValue is 2,147,483,647). OutOfMemoryException is OutOfMemoryException if an attempt is made to create an array with a large number of elements. This means that the LongLength property is still useless, and you can use the Length property instead .
I tested it on x64 platform using .NET 4.5. To create an array with 2,147,483,591 elements, I changed the configuration file and added:
<configuration> <runtime> <gcAllowVeryLargeObjects enabled="true" /> </runtime> </configuration>
I mainly used this page
source share