C#Dot Net Perls

 
Visual Studio TODO Comments

by Sam Allen
Shows TODO comments in Visual Studio 2008.

Problem

Keep track of tasks in Visual Studio by using TODO comments. These comments can help get you more organized about your projects. You want to get the interface set up and gain a way to list your to-do items in a central place, in a way that is simple and easy to remember.

Solution

TODO comments allow you to tell Visual Studio to maintain a central list of tasks, which it reads from many different places in your code. The Task List is a panel or floating window in Visual Studio that will display all the TODO comments in your project. To open the list, go to View menu -> Task List.

Some example TODO comments

You probably have a lot of code that needs a lot of work. If you don't, then you need to write code that needs a lot of work. Here are some examples of TODO lines that Visual Studio 2008 will notice and put into its special Task Pane.

//todo: fix dialog windows
//TODO: work on SQLCE guide
// Todo new screenshot

This will appear in your tasks pane as a separate task. Note that you have some flexibility with these tokens. The strings "todo", "TODO", and "TODO" all work equally well--Visual Studio's parser gives you a little bit of freedom.

What other comments can I use?

There are many different kinds of comment tokens and options. TODO comments are simply the most popular ones. Let's look at some task list options we can set in Visual Studio 2008. These steps will allow you to see all the different tokens that you can use. Go to Tools -> Options... -> Task List.

Discussion

You can go through your project and put TODO comments everywhere you need to do something. Also, there are a couple other predefined comment tokens you can use, called UNDONE and HACK. Experiment and find what suits your style the best, so you can be as productive as possible--or as productive as you want to be.

Dot Net Perls is dedicated to sharing code and knowledge. It has
© 2007-2008 Sam Allen. All rights reserved.

Ads by The Lounge