May 2008
3 posts
5 tags
How to get information about your current culture.
Instead of doing a college survery and asking a bunch of probing questions about the lives of twenty-somethings, there’s an easier way to get information about your current culture. Just look at CultureInfo.CurrentCulture. Here’s a quick program that explains how to do that. This can be very useful in debugging and troubleshooting how your program behaves on machines that are setup for...
6 tags
Refactoring a big if block into a simple command...
Recently someone had a problem where they had some massive control block full of if statements looking at a string, dispatching one of a variety of functions. The if block was massive. Hundreds of if statments, hundreds of magic strings. Interestingly all the functions had the same signature… So I gave him this example of how to use attributes on the methods to specify the corresponding...
9 tags
Filtering a network stream using a wrapper
So not that long ago, someone posted a question asking how to deal with a certain situation. The situation is such that there is a network file stream coming from somewhere, that has certain data you want to keep, and certain data you don’t want to keep. Control blocks, extra header information, weirdo protocol, too much data coming back form an API, etc.. My suggestion was to create a...