Comment and Uncomment Selection – New feature in NAV 2015

One of the small features in Microsoft Dynamics NAV 2015 is the ability to comment a selection of code.

Now I am not a huge believer in putting comments in code. Actually I am of the school that think comments are evil, because code should be written so it explains itself. That aside I find the new feature handy when testing and you want to take something out just for a test run.

How does it work?

If you are in the code you can mark a few lines of Code like this

Then click “Comment Seletion…” under the Edit Menu or use the shortcut Shift+Ctrl+K and the marked lines will be commented out by setting 2 forward slashes in front of the code at the left margin.

There is also an “Uncomment Seletion…” with the shortcut Shift+Ctrl+O that will remove the comments again.

Absolutely a help to developers, but please consider how you use comments.

Comments should not be needed in the final version of great code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.