Joe White’s Blog

Life, .NET, and Cats


ReSharper coolness of the day: TODOs and NotImplementedException

ReSharper adds much fancier syntax highlighting to Visual Studio. And I recently found an unexpected coolness in how they highlight TODOs.


TODO highlighting

One of the things ReSharper adds is highlighting of TODO comments. By default they’re bold and bright blue (as opposed to the non-bold green of regular comments), making them stand out nicely.

They also have a “To-do Explorer” window that lists all the TODO items in your solution.

NotImplementedException vs. NotSupportedException

Okay, it’s going to feel like I’m shifting gears for a minute here.

The .NET framework includes two exceptions that mean very nearly the same thing: NotImplementedException and NotSupportedException. I always used to have to stop and think about the difference between them, and which one I really wanted, every time I wrote — or read — code that used them.

Just for reference, here’s what they mean:

  • NotImplementedException: Placeholder. Often inserted by a code template. This means that the real code hasn’t been written yet. It’s basically a TODO with teeth.
  • NotSupportedException: Means “this space intentionally left blank”. We made a conscious decision here. This class does not and will not support this method. For example, an interface method that isn’t applicable for a given implementation.

Two great things that taste great together

In ReSharper 4.5, the following code will, under the default settings, highlight blue and bold, just like a TODO comment:

throw new NotImplementedException();

So with ReSharper, I don’t need to stop and think about the difference between NotImplementedException and NotSupportedException. They make it dead simple: if it highlights like a TODO comment, then it’s the one that really means TODO.

As I so often say when I’m talking about ReSharper: Sweet.

2 Responses to “ReSharper coolness of the day: TODOs and NotImplementedException”

  1. Dew Drop - April 27, 2009 | Alvin Ashcraft's Morning Dew Says:

    [...] ReSharper coolness of the day: TODOs and NotImplementedException (Joe White) [...]

  2. Ilya Ryzhenkov Says:

    You probably also noticed, that it is configurable :) I.e. it is just another pattern to match in identifiers.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


Joe White's Blog copyright © 2004-2011. Portions of the site layout use Yahoo! YUI Reset, Fonts, and Grids.
Proudly powered by WordPress. Entries (RSS) and Comments (RSS). Privacy policy