Tips & Tricks: Task List in Visual Studio

 Tips & Tricks     sbo     Updated on Apr 04, 2015     VIKRAM     202   

Introduction:

"Task List" is a feature which is available in Visual Studio IDE.

Example:

Assume we have a class Employee as shown below:

// We have still not created any properties for this class.
public class Employee
{
    // I will come back and code this later.
    public void Add()
    {

    }

    // For now i have done a hack to always return true.
    public bool IsValid()
    {
        return true;
    }

    // This method needs to be merged with Add Method.
    public void Update()
    {

    }
}

By looking at Employee class we can observe the following:

  • No properties added
  • Three methods are added. Namely they are Add(), IsValid(), and Update().

We have still not created any properties for this class, assume we will add them later. And i have a method called Add(). I have still not coded anything in that. Assume, in future i will come back and code this Add() method. IsVaid() method always returns true. This is some kind of Hack. Hack means, irrespective of it's functionality it always returns true. In feature we can add some logic here for validation. I have also method called Update(), probably we will merge this with Add() method.

In Employee class i have put certain comments. Depending upon these comments, we will go and code later. After some time down the line, we may forget these comments. We won't come back here. It would be great if we see these comments in a consolidated manner (or) list. So here comes Task List into picture. We have a beautiful feature called Task List in Visual Studio IDE.

Where we can find this option?

Goto Tools >> Options as shown below:

Select Options then it will shows popup as shown below:

Goto Environment >> Task List. Then you will find token list on the right side. Tokens means some kind of keywords. Following are the reserved keywords for tokens:

  1. Hack
  2. TODO
  3. UNDONE
  4. UnresolvedMergeConflict

We can use these tokens in our comments. If we put these tokens in our comments, depending upon tokens, we can see the complete comment in task list.

Now i'm adding these tokens in our existing comments as shown below:

// UNDONE: We have still not created any properties for this class.
public class Employee
{
    // TODO: I will come back and code this later.
    public void Add()
    {

    }

    // Hack: For now i have done a hack to always return true.
    public bool IsValid()
    {
        return true;
    }

    // UnresolvedMergeConflict: This method needs to be merged with Add Method.
    public void Update()
    {

    }
}

Note: Task List tokens are used without colon(:) only. I will recommend to use tokens with colon(:).

Now lets go and see the magic of Task List.

Goto View >> Task List as shown below

All the commets are displayed in Task List in a grid fashion. Now we can select appropriate comment/activity easily. So that it can be fixed.

Thats it. I hope you enjoyed this article. We will add more articles on "Tips & Tricks" in the coming days.

  Related Articles
Tips & Tricks: Drag and Drop code from Visual Studio Toolbox
Tips & Tricks: Remove Parameters and Reorder Parameters in Visual Studio
Tips & Tricks: Extract Method in Visual Studio
Tips & Tricks: Rectangular selection of code in Visual Studio
  Recent Articles
Tips & Tricks: Drag and Drop code from Visual Studio Toolbox
Tips & Tricks: Remove Parameters and Reorder Parameters in Visual Studio
Tips & Tricks: Extract Method in Visual Studio
Tips & Tricks: Rectangular selection of code in Visual Studio