[Mono-dev] mono numerical performance

Konrad M. Kruczyński konrad.kruczynski at gmail.com
Sun Nov 20 12:22:10 EST 2011

Hi again,

> It is too bad that one cannot declare a primitive expression to be
> locally const in C#.  

Maybe one could get away with something like this:

    public struct FinalBox<T>
        public FinalBox(T value)
            this.value = value;

        public T Value
                return value;

        public static implicit operator T(ReadOnlyBox<T> box)
            return box.value;

        private readonly T value;

Such construct may inform JIT that given value won't change (if
getter/operator is inlined which I hope happens). And with implicit
operator it's quite usable.


More information about the Mono-devel-list mailing list