- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Edit Admin
My money is on this being a WTF.
But it is conceivable that it can be used to change the collection size in much the same way that StringBuilder.Length is used. I have on occasion used StringBuilder for doing things like comma separated lists where the last item must not have a comma and I can achieve it like so:
Edit Admin
My best guess would be that it began life as a sort of proto-C++, back well before the arrival of C++98's STL, or maybe even just plain C, and was then "ported" to C-flat, and management said, "You shall port all the old code, really all of it. We'll get someone from outside to audit what you did, and if the auditors find anything that wasn't ported, there will be seventy-three kinds of Hell to pay!" So they did exactly what they were told, and left nothing of the old code out of the port, for fear that management really meant "three hundred seventy" when they said "seventy-three".
No, wondering about it is not a WTF. Well, maybe it is. Maybe the correct verb is "despair"...
Edit Admin
I mean, writable length properties are not really that special, System.IO.Stream has one of those as well, as do various builders like StringBuilder.
Edit Admin
A lot of people just automatically make getters and setters for all properties because they don't really know why they're supposed to have private variables.
Edit Admin
This seems most likely.
Admin
That sounds plausible to me. I interned at a company that builds such machines around the turn of the century and they were using plain C at the time.
Edit Admin
I think you have a wrong word in there. Try this instead:
Admin
As pointed out in the highlighted comment of 2026-02-18's article, why not do something to the effect of, "if there is more than one item in the list, add the first one to the stringbuilder, then for all the rest add a comma and the next item"? Means you don't have to remove anything at the end.
Edit Admin
Depends. I've seen properties used to add range-checking (or null-checking) to variables that would otherwise be public.
Admin
That'll remove the comma and the preceding item. What happens if the list is empty?