The Old New Thing

On partially-constructed objects, additional remarks, not as interesting

Don't worry. Our long national nightmare of CLR week is almost over. I had originally planned to write an article about partially-constructed objects, but in the time since I queued up the topic (back in November 2005) to the time I got around to writing it up, I found that Joe Duffy had already written it for me! On partially-...

Weak references have no effect on object lifetime

The class lets you retain a reference to an object while still permitting the object to be garbage collected. When that happens, then the property is and the property is . (Related discussion.) Note, however, that weak references do not alter the decision of the garbage collector whether or not an object is garbage. It merely lets you ...

The mysterious ways of the params keyword in C#

If a parameter to a C# method is declared with the keyword, then it can match either itself or a comma-separated list of um itselves(?). Consider: This program prints The first call to does not take advantage of the keyword and passes the array explicitly (formally known as normal form). The second call, however, specifies the ...

A practical reason for shutting down for the Mayan apocalyse

I dreamed that Costco announced that they were closing for the Mayan apocalypse and would reopen two weeks later. Not because they believed in it. Rather, because that was their estimate as to how long it would take people to get through their stockpiles and be ready to go shopping again. Curiously, I had this dream several weeks after the ...

Why does BitConverter.LittleEndian return false on my x86 machine?

Welcome to CLR Week 2013, returned from its two-year hiatus. A customer reported that when they checked with the debugger, reported even though they were running on an x86 machine, which is a little-endian architecture. The bytes are extracted in little-endian order, despite the claim that the machine is big-endian. "I don't get it...

The case of the auto-hide taskbar

A customer reported that their taskbar would sometimes spontaneously go into auto-hide mode. What made this particularly insidious was that they had deployed a group policy to prevent users from changing the auto-hide state (because they never wanted the taskbar to auto-hide), so when the taskbar went into auto-hide mode, there was no way to ...