How to add a comment to the new method stub in Visual Studio?

Viewed 91

If I let VS add a new method, it creates something like this:

    public void DoSomething(object withThis)
    {
        throw new NotImplementedException();
    }

I want to add a comment and get something like this instead:

    public void DoSomething(object withThis)
    {
        throw new NotImplementedException(); //TODO: Implement me!
    }

That way a new and not implemented method would automatically appear in the task list.

1 Answers

I haven't tested this particular scenario, but you could try editing the corresponding *.snippet file. It's called MethodStub.snippet and lies in x:\Microsoft Visual Studio\2019\Enterprise\VC#\Snippets\1033\Refactoring\MethodStub.snippet on my PC.

The result could look something like this:

<Code Language="csharp">
            <![CDATA[$signature$
{
    $end$throw new $Exception$(); //TODO: Implement me!
}]]>
</Code>
Related