Home > Articles > Web Development

  • Print
  • + Share This
Like this article? We recommend

Like this article? We recommend

Step 3: Create a Harness

There are several approaches to creating a harness in which to run your snippet, but let's go with something very, very easy. Assume that each piece of code is its own entity. It needs to be written, handled, and tested separately—sort of like an application, huh? Precisely like an application! Build a classic dummy app—a form with a single button, or a command-line app that doesn't take any parameters—and add a class to it. In essence, we're giving you a sandbox where you can play without fear of breaking anything else, and make certain that you understand both what goes into and out of this function, without affecting the other code you need to upgrade.

We'll build a one-button form in C# and slap a class file into it for our drive-mapping code. It looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NetConnectSnippet
{
    class DriveMappingSnippet
    {

    }
}

Nothing too exciting. We'll get to deeper stuff in a moment.

  • + Share This
  • 🔖 Save To Your Account