Choosing a Text Editor

   


Text editors used for writing source code range from the simple no frills Notepad editor to sophisticated editors, such as those found in Visual Studio .NET. The more elaborate editors are specifically targeted at writing code and, consequently, provide many features that can help the programmer. We will not delve into any of those features; we'll assume that you are using the freely available Notepad, which can be found on any Windows platform.

When choosing a text editor, you need to be aware of the following important details:

  • All C# source files must be saved with no formatting. If you use a word processor to create the source code, you must save the file as Text Only. Different editors use different names for Text Only, such as Plain Text, ASCII Text, and DOS Text.

  • Even though advanced word processors are helpful when writing letters, books, and so on, they are not targeted at program development. They're not helpful for this purpose.

  • Editors, such as Notepad, might add an extra .txt file extension to the filename of any C# source file you save even if you have already specified the .cs extension. Only files with the extension .cs are recognized by the C# compiler and accepted for compilation, so this would create an error message when you attempt to compile the source code file. You can avoid this problem by placing quotation marks around the filename and its extension (.cs) when saving the file. For example, if you want your source code file to be called Shakespeare.cs, as the program shown later, you can type "Shakespeare.cs" in the Save As window instead of just Shakespeare.cs, as illustrated in Figure 2.12 shown later.

    Figure 2.12. Saving the Shakespeare.cs source code.
    graphics/02fig12.gif
  • In many ways, it can be advantageous to start out with a simple text editor like Notepad because you can focus on learning C# instead of being sidetracked by the numerous features of a sophisticated C# editor. The many hundred pages of documentation accompanying Visual Studio.NET illustrate this point.


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net