C#

NDepend on a Real Project, Round 1.4: Mutually Dependent Namespaces

This is the fourth in a series of blogs looking at things NDepend told me about a personal project of mine - this time mutually-dependent namespaces.

NDepend on a Real Project, Round 1.3: An Exception by Any Other Name...

This is the third in a series of blogs looking at things NDepend told me about a personal project of mine - this time a curious problem with Exception naming.

NDepend on a Real Project, Round 1.2: Dead Methods

This is the second in a series of blogs about things NDepend told me about a personal project of mine. This time, methods which are apparently never called.

No More NCrunch For Me

NCrunch is a Visual Studio add-in which runs your tests while you work so you know if you've broken anything, as well as providing coverage indicators in the IDE and coverage metrics on demand. It recently went commercial, and time is running out for the free version I've been using for the last couple of months. From my experiences using NCrunch I'm going to let it expire, and go about my business without it. Here's why.

Interview question - there's a lot wrong with this code :)

I had some really great responses to my last post regarding some bad code I've shown to interviewees - pretty much everything I intended to be bad was spotted, as well as some interesting points I hadn't considered. Here's the code again along with the bad bits as I saw them, and then I'll go over the extra points raised in the comments.

NDepend on a Real Project, Round 1.1: the Dashboard and a Non-Protected Abstract Class Constructor

The other day I got an email from Patrick Smacchia, generously offering me an NDepend licence on the grounds that if I find it useful I can write about it on my blog. NDepend allows you to write Linq queries against an assembly or a code base to interrogate it for quality issues and see various metrics and reports. I have a personal project underway which I've been working on for some time, so I figured I'd give it a go and see what it can tell me. This is the first of the results.

Using Dependency Injection When Calling .NET Over COM

I've recently been working with a number of VB6 systems which use C# .NET components via COM, and wanted to keep the same sort of organisational structures and patterns in the C# part of the application as I would if it was a standard MVC app or WCF service - namely, using Dependency Injection to plug the various C# classes together. This is easier said than done with COM, but here's an approach I've used to achieve it.

A Generic, IDisposable, Unit-Testable, Error-Handling WCF Service Client

I recently reused my generic, disposable WCF service client, and made some changes to make it simpler to use and easier to unit test. Here's what I did.

GetValueOrDefault() For An Expression of Arbitrary Length Using Expression Trees

In my most recent project we had to support classes with fairly deep object graphs where any of the nodes could validly be null. We didn't want to have lots of 'if not null' checks everywhere, so I wrote an extension method which takes an expression of any length and returns the expression value or a default value if any of the nodes are null. Here's the extension method code, along with an overview of how it works.

Extending WatiN 3: Detecting if a PDF Has Opened In a New Window

WatiN lets you attach to browser windows so you can verify their contents and close them as part of your tests, but the standard API doesn't detect windows with PDF documents in them. Here's an extension method which does.

Full C# Archive