.NET Tips and Tricks

Blog archive

Visual Studio Tip: Printing Code to Support Code Review

I don't often print my code out when I'm working at home (too cheap to pay for the ink), but it's something that my clients ask for more often than I expect. The usual reason I'm asked to print my code is to support a code review. By default, the printing process uses the same settings your code editor does, which isn't always appropriate. When you print out your code, you should set up your pages to support the code review process.

There are two obvious options to pick when printing your code, because they appear right in the Print dialog. In the lower left-hand corner of the dialog, you can check off the option to hide collapsed regions, a good way to focus the reader's attention on the code that's being reviewed by collapsing the irrelevant parts of your code before printing (and save some ink!). You can also check off an option to include line numbers, which makes it much easier to refer to specific lines of code.

In the Page Setup dialog, there's another option that's worth checking (it's set by default in some versions of Visual Studio): Page Header. That will print the full path name for the code file at the top of each page, making it easier to refer to code files (and collate your pages if you drop them).

But there's more you can do: Go to Tools/Options/Environment/Fonts and Colors and set the dropdown box at the top of the dialog to Printer. Now you can set up your print options to support your code review. For instance, several studies have shown that serif fonts (like Courier New) are easier to read on paper than san-serif fonts (like Visual Studio's default Consolas): change the font to a monospaced serif font (the monospaced fonts are in boldface). There's not much point in highlighting breakpoints in the printed code, so you might also want to set breakpoints to plain old black on white.

That's just a start on what you might want to change, but you've already focused the reviewer's attention, made it easier to find what you're talking about, made it easier to read, and got rid of an annoying distraction. Not bad for five minutes' work.

Posted by Peter Vogel on 03/14/2013


comments powered by Disqus

Featured

  • Full Stack Hands-On Development with .NET

    In the fast-paced realm of modern software development, proficiency across a full stack of technologies is not just beneficial, it's essential. Microsoft has an entire stack of open source development components in its .NET platform (formerly known as .NET Core) that can be used to build an end-to-end set of applications.

  • .NET-Centric Uno Platform Debuts 'Single Project' for 9 Targets

    "We've reduced the complexity of project files and eliminated the need for explicit NuGet package references, separate project libraries, or 'shared' projects."

  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

Subscribe on YouTube