Can't create huge arrays

前端 未结 2 1381
南旧
南旧 2020-12-06 16:33

Like many other programmers, I went into primes, and as many of them, what I like is the challenge, so I\'m not looking for comment like Atkin did this faster than you d

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-06 17:27

    If you hit the bounds of the integer max range, you can opt to use a long-index-based array.

    The problem is that this isn't supported by the C# indexer properties, which uses int. You can build them by hand though by using Array.CreateInstance(Type, long[]).

    Note you have to get the values using Array.GetValue(long).

提交回复
热议问题