[Mono-dev] Possible QuickSort optimizations for Array.Sort()
robertj at gmx.net
Wed Apr 6 10:40:57 EDT 2011
On 06.04.2011 15:48, Jeffrey Stedfast wrote:
>> static readonly int INSERTIONSORT_THRESHOLD = 7;
>> Why not to used const int ?
> I never learned when to use const vs static/readonly in C# :-(
Consts will be expanded inline by the compiler.
cons: versioning trouble when the const is public and it is
consumed by another assembly.
Fields marked with the "readonly" modifier are not inlined
because they are still normal fields.
pros: no versioning issues.
More information about the Mono-devel-list