Visual Studio 6
Because my background in development for Microsoft Windows is entrenched in the Microsoft Visual C++ language, Microsoft Visual Studio 6 is naturally my editor of choice. Visual Studio is a full-featured editor that includes all the features necessary to edit and save C# files.
One of the biggest advantages of using a programmer's editor is syntax highlighting. However, because Visual Studio 6 was released a couple of years before C# and was designed to develop Visual C++ applications, you'll need to do a little tweaking for Visual Studio 6 to highlight C# code correctly. The first step is to change a Visual Studio Registry key. Locate the following key in your Registry by using Regedit.exe or another Registry editor: -
HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\ Text Editor\Tabs/Language Settings\C/C++\FileExtensions
The value will contain a string like the following: -
cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2
Add the .cs extension at the end of the value. (Note that an ending semicolon is optional.) The new Registry value would look like this: -
cpp;cxx;c;h;hxx;hpp;inl;tlh;tli;rc;rc2;cs
Now, when you open a file in Visual Studio 6 with a .cs extension, Visual Studio will recognize it as a supported file.
Next you need to tell Visual Studio which files are keywords in C#. To do this, you create and place in the same folder as the msdev.exe file a file named usertype.dat. This is an ASCII text file that contains all the keywords that should be highlighted-place one keyword on each line. When Visual Studio starts up, it will load this file. Therefore, when you make a change to this file, you must restart Visual Studio to see your changes. I've included a copy of a usertype.dat file on this book's companion CD that lists all the keywords for the C# language. Figure 3-1 shows what your C# code will look like once you've followed these steps.
-
Figure 3-1 One advantage of using an editor that provides syntax highlighting like the one in Visual Studio 6 is immediate feedback as to whether a keyword is valid.-