C Sharp

Writing Your First C# Application

Let's go through the steps to get your first C# application up and running.

Choosing an Editor

Before you write a C# application, you need to choose an editor. The following sections describe the most prevalent editors and offer some pertinent facts about choosing an editor for your C# development.


Microsoft Notepad has been the most commonly used editor during the early stages of C# for developers using the .NET Framework SDK to write C# applications. I used Notepad for some other reasons I'll outline later. However, I wouldn't recommend using Notepad for the reasons described.

  • C# files should be saved with an extension of .cs. However, in Notepad's File Save dialog box, if you're not careful, attempting to name your file something like Test.cs will result in a file named test.cs.txt unless you remember to change the setting in the Save As Type drop-down list box to "All Files."

  • Notepad doesn't display line numbers-a major pain when the compiler reports an error on a given line.

  • Notepad inserts eight spaces for a tab, which means that writing anything beyond "Hello, World" can make applications difficult to read.

  • Notepad does not perform automatic indenting when you press the Enter key. Therefore, you have to manually tab over to the desired column to enter a line of code.

Other reasons exist, but as you can see, Notepad is not a good choice for developing C# applications.