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-...
Comments are closed.0Code

The mathematical card game Krypto and reaching a level of proficiency where the rules break down

There is a mathematical card game known as Krypto. The rules are simple: Each card has a numeric value. Six cards are dealt face-up in the center of the table: One card is designated as the objective card. The object of the game is to combine the remaining five cards in any order using the basic four arithmetic functions so that the result ...
Comments are closed.0

Weak references have no effect on object lifetime

The Weak­Reference class lets you retain a reference to an object while still permitting the object to be garbage collected. When that happens, then the Is­Alive property is false and the Target property is null. (Related discussion.) Note, however, that weak references do not alter the decision of the garbage collector whether or not...
Comments are closed.0Code

Sometimes sports-rule lawyering comes true: The strikeout with only one thrown pitch

Some time ago, I engaged in some sports-rule lawyering to try to come up with a way the losing team could manage to salvage a win without any remaining at-bats. It involved invoking a lot of obscure rules, but astonishingly one of the rules that I called upon was actually put into effect a few days ago. The Crawfish Boxes provides an ...

The mysterious ways of the params keyword in C#

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

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, Bit­Converter.Little­Endian reported false 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 ...
Comments are closed.0Code

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 ...
Comments are closed.0Other