Home > Articles > Programming > C#

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

Like this article? We recommend

Testing the C# Compiler

You don't get a nice graphical integrated development environment (IDE) to develop and test your C# code. Instead, you have to write the code in a text editor such as Notepad, and compile it manually. (This may actually be "a good thing™" for beginners. Research conducted by the authors suggests that for beginners, one of the barriers to learning to program is learning the IDE. "Manually" writing, compiling, and debugging keeps beginners focused on developing programming skills and not on developing navigation skills for an IDE."

Opening a DOS Window

To develop C# programs manually, you'll need to open a DOS window. Follow these steps:

  1. Click the Windows Start button and select Run from the pop-up menu. The familiar Run dialog box appears.

  2. Type command in the text box (see Figure 31) and click OK to open a DOS window (see Figure 32).

Figure 31 The Run dialog box.

Figure 32 The DOS window.

NOTE

Your DOS window may look very different from ours. You probably have a window with a black background with white text. We changed the default properties of our window to have a white background and black text.

Next, we'll create a folder named csharp, where we'll place all our code.

Creating a File Folder for Your C# Files

You should store all the code you create in its own folder; we'll call our folder csharp for this example. Probably the easiest way to create a folder is with Explorer. However, since you already have a DOS window open from the preceding section, we'll use it to create the folder manually and then change to that folder.

  1. Type mkdir csharp and press Enter (see Figure 33). The mkdir command (or you can just type it as md) stands for make directory (folder). DOS creates the new folder as a subfolder of the current folder. In Figure 33, the full pathname for the new folder would be c:\csharp.

    After you execute the command, the cursor simply returns to the command line. You won't get any indication that the folder was created, but trust us, the new folder does exist.

    Figure 33 Creating the csharp folder.

    You only need to create the csharp folder once. Afterwards, whenever you open a DOS window to do C# programming, you just move to this folder as follows:

  2. Type cd csharp and hit Enter (see Figure 34). The cd command stands for change directory (folder).

    You are now in the csharp folder and can start developing C# code.

    Figure 34 Changing the current folder to the csharp folder.

  • + Share This
  • 🔖 Save To Your Account