.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

Featured

  • How to Create a Machine Learning Decision Tree Classifier Using C#

    After earlier explaining how to compute disorder and split data in his exploration of machine learning decision tree classifiers, resident data scientist Dr. James McCaffrey of Microsoft Research now shows how to use the splitting and disorder code to create a working decision tree classifier.

  • Microsoft: Move from Traditional ASP.NET to 'Core' Requires 'Heavy Lifting'

    There are plenty of reasons to move traditional ASP.NET web apps -- part of the old .NET Framework -- to the new cross-platform direction, ASP.NET Core, but beware it will require some "heavy lifting," Microsoft says.

  • Purple Blue Nebula Graphic

    How to Compute Disorder for Machine Learning Decision Trees Using C#

    Using a decision tree classifier from a machine learning library is often awkward because it usually must be customized and library decision trees have many complex supporting functions, says resident data scientist Dr. James McCaffrey, so when he needs a decision tree classifier, he always creates one from scratch. Here's how.

  • Blazor's Future: gRPC Is Key

    Blazor guru Steve Sanderson detailed what Microsoft is thinking about the future of the revolutionary project that enables .NET-based web development using C# instead of JavaScript, explaining how gRPC is key, along with a new way of testing and a scheme for installable desktop apps.

  • Don't Do It All Yourself: Exploiting gRPC Well Known Types in .NET Core

    If you're creating business services that send dates and decimal data then you may be concerned that gRPC services don't support the relevant data types. Don't Panic! There are solutions. Here's how to use them.

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.

Upcoming Events