.NET Tips and Tricks

Blog archive

Smart Paster Makes Life Easier

You don't have to pay for everything you want. There are a lot of free tools out there that will may your life better. Obviously, when I get a free tool I don't look at the price. What I do look for is useful functionality, simple installation, a quick start and whether the tool fits with the way I work. I find that I'm more willing ignore "fit and finish" issues with a free tool.

Smart Paster is a good example. It's a tool that I use a lot. I'm constantly pasting strings into my programs and formatting them to work as string values. For C# this means breaking long strings up to concatenate them together and adding the @ prefix. Smart Paster adds a Paste As... option to the popup menu when you right mouse click in an editor window. If you pick the String choice in a C# file, this is what you get:

@"Smart Paster is a good example. " +
@"It's a tool that I use a lot. " 

In Visual Basic you get the line continuation characters:

"Smart Paster is a good example. " & _
"It's a tool that I use a lot. " 

You can customize how long your strings will be.

But wait, there's more! The other paste operation I do with strings is to create a StringBuilder. There's a menu choice for that, too. When you do a StringBuilder paste, you need to provide the name of your variable and this is what you get:

Dim sbArticleText As New StringBuilder(421)
sbArticleText.AppendFormat("Smart Paster is a good example.")
sbArticleText.AppendFormat("It's a tool hat I use a lot")

The tool even handles escaping embedded quotes. What are my complaints? A minor one: The choices that I use are on a submenu and I wish they were directly on the popup menu. A second minor complaint: I wish that double quotes were handled by replacing them with single quotes -- it would make it easier to paste XML into string constants.

My biggest issue is installing the package. The Visual Studio 2008 version is only available as source code and comes without installation instructions. Get your version here, which provides a compiled version and instructions on how to install it (you have to extract a zip file to the right place). This is one of those "fit and finish" issues that I'm willing to overlook in a free tool.

You can also paste into a Region and as a comment but I've never used them.

Posted by Peter Vogel on 04/16/2010

comments powered by Disqus


  • 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.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube