net-nugget

.NN #18: Another use for Using

If you are a C# developer you’re familiar with the using directive. It appears at the top of every one of your class files informing the compiler what namespaces should be looked at while compiling this code page so that you don’t have to fully qualify every object. (This isn’t the interesting bit) using System; using System.Collections.Generic; But did you also know you can use it to make aliases? (This still isn’t the interesting bit, keep reading…)

.NN #17: MSTEST ExpectedException Attribute

This post has been sitting in my draft folder for a while. At my client we use the Visual Studio Team Suite set of products, which means we also use MSTest for unit testing. I’m not going to get into MSTest vs. XUnit vs. NUnit vs. MbUnit, but I do have a comment about the implementation of the ExpectedException attribute from MSTest. Let’s say that I have some code that can throw a series of the same exception.

.NN #16: Cool Attributes and A Preprocessor Directive or Two

For this .NET Nugget I’d like to touch on a few cool code Attributes and a couple of helpful PreProcessor Directive in C#. The first attribute I’d like to bring up is Obsolete (no, it isn’t obsolete, but it tells other developers that some code object is Obsolete). This is a really handy attribute you use during development to keep track of dying or dead methods. You can use this attribute to mark up a method as Obsolete, informing other developers that at some point in the future this method will be deprecated.