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
        {
            get
            {
                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.

--
Regards,
 Konrad

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list

Reply via email to