/*========================================================================= ** Retrieves the value from the specified slot. ** =========================================================================*/ public Object GetData(LocalDataStoreSlot slot) { Object o = null; // Validate the slot. m_Manager.ValidateSlot(slot); // Cache the slot index to avoid synchronization issues. int slotIdx = slot.Slot; if (slotIdx >= 0) { // Delay expansion of m_DataTable if we can if (slotIdx >= m_DataTable.Length) { return(null); } // Retrieve the data from the given slot. o = m_DataTable[slotIdx]; } // Check if the slot has become invalid. if (!slot.IsValid()) { throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed")); } return(o); }
/*========================================================================= ** Retrieves the value from the specified slot. ** =========================================================================*/ public Object GetData(LocalDataStoreSlot slot) { // Validate the slot. m_Manager.ValidateSlot(slot); // Cache the slot index to avoid synchronization issues. int slotIdx = slot.Slot; if (slotIdx >= 0) { // Delay expansion of m_DataTable if we can if (slotIdx >= m_DataTable.Length) { return(null); } // Retrieve the data from the given slot. LocalDataStoreElement element = m_DataTable[slotIdx]; //Initially we prepopulate the elements to be null. if (element == null) { return(null); } // Check that the element is owned by this slot by comparing cookies. // This is necesary to avoid resurection ----s. if (element.Cookie == slot.Cookie) { return(element.Value); } // Fall thru and throw exception } throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_SlotHasBeenFreed")); }