T GetValueThreadLocal() { DataSlotWrapper myWrapper = GetWrapper(); if (myWrapper.Creating) { throw new InvalidOperationException("The initialization function attempted to reference Value recursively"); } return(myWrapper.Getter()); }
T GetValueThreadLocal() { DataSlotWrapper myWrapper = Thread.GetData(localStore) as DataSlotWrapper; // In case it's the first time the Thread access its data if (myWrapper == null) { myWrapper = DataSlotCreator(); Thread.SetData(localStore, myWrapper); } return(myWrapper.Getter()); }