Introducing DecimalMath

Ever been working on a project that requires Decimal precision, but then stuck because you need to use something from System.Math that would shave off half your precision? I was in a similar situation several years ago. It made me wonder what it would actually take to implement something like Pow with a fractional exponent […]

Monitoring Locks in a C# Multi-threaded Application

The Hairy Problem The other day I was debugging a hairy deadlock in a large application at work. When I say hairy, I mean dozens of threads, all potentially able to walk through the same areas, events raised inside a lock, and calls to other methods that recursively enter the same lock. The only way […]

Obfuscating a ClickOnce Publish in VS 2010

Awhile ago I wrote about how I used msbuild tasks to support obfuscating a project before generating a publish manifest and publishing a project using ClickOnce. It had some limitations but it has served me well for a long time. I recently upgraded to VS 2010 and found that the old targets didn’t work. Some […]

Preventing ClickOnce from Publishing a Debug Configuration

You’ve all had it happen. You just put the finishing touches on your project and you hit the Publish button. The files are automatically copied to the file server and users start get the updates right away. You double-check the publish and then you realize that you published the DEBUG version with all your program […]

Obfuscating a ClickOnce Publish

Edit: See updated version specifically for use with VS 2010. I needed to create a ClickOnce publish of an obfuscated exe for a customer since he was concerned about theft of his intellectual property. I added in several security features, but they were worthless if I couldn’t harden the executable against decompilers like .Net Reflector. […]

Excellent Windows API Tool

I stumbled across this add-in which automates the insertion of various Windows API declarations. If you’re like me, you track down solutions to your problem on the Internet, but sometimes it uses an API declaration in C# or VB6. Even worse, sometimes someone will use a non-standard or just plain difficult declaration style, for example: […]

When Compiler Directives Aren’t Enough

If you’ve programmed for any length of time in .NET, you’re probably familiar with the DEBUG compiler constant that you can use to designate code to compile and run depending on your build configuration (e.g. Debug or Release). But very often you don’t care about the configuration you’re running–what you do care about is distinguishing […]

Converting VB.NET 2003 WinForms to 2005/2008 Partial Classes

Ever been stuck working in VB.NET 2005 or 2008 with a project created in VB.NET 2003? Aside from language differences, you’re stuck with forms that except for resources are in one file. Not only is this ugly, but it makes the IDE slower, since it redraws when it detects any changes to a file that […]

CodeProject: StringEnum

Some time ago I submitted an article to CodeProject and I thought I’d post a link to it here. It’s not a new idea, but I think a novel implementation. The article’s purpose is to provide functionality like an Enum, but using a string as the target data type. I’ve actually used it quite frequently […]