Example #1
0
        public override T this[int key]
        {
            get
            {
                if (key < minIndex || key > maxIndex)
                {
                    return(null);
                }

                return(Volatile.Read(ref arrayData[key - minIndex]));
            }
        }
Example #2
0
        public override T this[int key]
        {
            get
            {
                if (key < minIndex || key > maxIndex)
                {
                    return(null);
                }

#if NET45PLUS
                return(Volatile.Read(ref arrayData[key - minIndex]));
#else
                return(Interlocked.CompareExchange(ref arrayData[key - minIndex], null, null));
#endif
            }
        }
Example #3
0
 public static unsafe Object LoadReferenceTypeField(IntPtr address)
 {
     return(Volatile.Read <Object>(ref Unsafe.As <IntPtr, Object>(ref *(IntPtr *)address)));
 }
Example #4
0
 public static unsafe void StoreReferenceTypeField(IntPtr address, Object fieldValue)
 {
     Volatile.Write <Object>(ref Unsafe.As <IntPtr, Object>(ref *(IntPtr *)address), fieldValue);
 }