Click here to Skip to main content
14,602,992 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Mike Hankey31-May-18 14:29
professionalMike Hankey31-May-18 14:29 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
OriginalGriff31-May-18 22:18
mveOriginalGriff31-May-18 22:18 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Mike Hankey1-Jun-18 1:26
professionalMike Hankey1-Jun-18 1:26 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Member 115770084-Jun-18 3:23
MemberMember 115770084-Jun-18 3:23 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Richard Deeming31-May-18 9:58
mveRichard Deeming31-May-18 9:58 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Marc Clifton31-May-18 10:43
mvaMarc Clifton31-May-18 10:43 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
PIEBALDconsult31-May-18 10:13
professionalPIEBALDconsult31-May-18 10:13 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Jon McKee31-May-18 10:17
professionalJon McKee31-May-18 10:17 
The problem is that you're assigning a static variable inside the instance constructor to that instance . So every time you create an object you're changing the Context property. The reason the tests are different is because you pass the Context as a parameter so even after the update the parameter still has the old Context.

A fix would be to not do that because it's bad design Poke tongue | ;-P I'd make Context an instance property and implement your own ==, !=, Equals, etc unless you want referential equality.
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Richard Deeming31-May-18 10:19
mveRichard Deeming31-May-18 10:19 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Jon McKee31-May-18 10:22
professionalJon McKee31-May-18 10:22 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Richard Deeming31-May-18 10:42
mveRichard Deeming31-May-18 10:42 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Marc Clifton31-May-18 10:48
mvaMarc Clifton31-May-18 10:48 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Richard Deeming31-May-18 11:01
mveRichard Deeming31-May-18 11:01 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Marc Clifton1-Jun-18 1:54
mvaMarc Clifton1-Jun-18 1:54 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
soulesurfer3-Jun-18 21:34
Membersoulesurfer3-Jun-18 21:34 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
englebart4-Jun-18 2:57
professionalenglebart4-Jun-18 2:57 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
jfren4844-Jun-18 8:10
Memberjfren4844-Jun-18 8:10 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
Q The First Timelord4-Jun-18 8:27
MemberQ The First Timelord4-Jun-18 8:27 
GeneralRe: Code Puzzler: How quickly can you figure out why this acting "weird"? Pin
AnotherKen7-Jun-18 20:57
professionalAnotherKen7-Jun-18 20:57 
GeneralMmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 6:10
mveOriginalGriff31-May-18 6:10 
PraiseRe: Mmmm - it' s nice to know that they care about me... Pin
lopatir31-May-18 6:27
Memberlopatir31-May-18 6:27 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Eddy Vluggen31-May-18 7:54
professionalEddy Vluggen31-May-18 7:54 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 8:00
mveOriginalGriff31-May-18 8:00 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
Eddy Vluggen31-May-18 8:16
professionalEddy Vluggen31-May-18 8:16 
GeneralRe: Mmmm - it' s nice to know that they care about me... Pin
OriginalGriff31-May-18 8:22
mveOriginalGriff31-May-18 8:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.