.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 at 1:16 PM

comments powered by Disqus


  • Visual Studio Code Dev Team Cleans Up

    The Visual Studio Code development team focused on some housekeeping in the October update, closing more than 4,000 issues on GitHub, where the cross-platform, open-source editor lives.

  • ML.NET Model Builder Update Boosts Image Classification

    Microsoft announced an update to the Model Builder component of its ML.NET machine learning framework, boosting image classification and adding "try your model" functionality for predictions with sample input.

  • How to Do Naive Bayes with Numeric Data Using C#

    Dr. James McCaffrey of Microsoft Research uses a full code sample and screenshots to demonstrate how to create a naive Bayes classification system when the predictor values are numeric, using the C# language without any special code libraries.

  • Vortex

    Open Source 'Infrastructure-as-Code' SDK Adds .NET Core Support for Working with Azure

    Pulumi, known for its "Infrastructure-as-Code" cloud development tooling, has added support for .NET Core, letting .NET-centric developers use C#, F# and VB.NET to create, deploy, and manage Azure infrastructure.

  • .NET Framework Not Forgotten: Repair Tool Updated

    Even though Microsoft's development focus has shifted to the open-source, cross-platform .NET Core initiative -- with the aging, traditional, Windows-only .NET Framework relegated primarily to fixes and maintenance such as quality and reliability improvements -- the latter is still getting some other attention, as exemplified in a repair tool update.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events