Getting Started with C#
About the Editors
Choosing an editor for coding the source code is a tedious task facing every programmer. There will be various types of editors brought out by different companies. They are elaborated below in detail.
Notepad
Notepad is the best and most widely used editor among developers using .NET SDK. It comes with every edition of the Windows operating system and it's easy to use. Also, it does not require much investment.

Figure 3Hello.cs in Notepad
However, it is not the most suitable editor because it does not support syntax coloring and highlighting, compilation and execution directly from the editor, code numbering, and so forth. But as you know, Notepad in Windows 2000 Professional supports the famous Ctrl+G shortcut for finding line numbers.
Visual C++ 6.0
Developers can use Visual C++ 6.0, included with Visual Studio 6.0. However, they should do some tweaking in the Registry before using it. It supports syntax colorings and other features such as finding line numbers (Ctrl+G). However, it is dangerous for a new user to make changes in the Registry. Hence, only advanced and experienced users should use Visual Studio 6.0 for developing C#. It's not possible to compile and execute the applications from the Visual C++ 6.0 environment. Hence, it is not of much use except for some of the features listed above.
Visual Studio .NET
Visual Studio .NET provides all the integrated tools and wizards for creating C# and other .NET-based language applications. It also supports features such as Intellisense, Dynamic help, and so on. Moreover, you can compile and execute your applications from the IDE itself. Hence, to experience the power of developing the .NET applications, you should try Visual Studio .NET. But be prepared to pay a huge sum for this wonderful stuff.
Third-Party Editors
Many third-party editors are now available and can be downloaded from the Internet. One such editor is called the Antechninus C# Editor. It supports color-coding, compilation and execution from the IDE, project maintenance, and accessing the .NET Framework documentation by using its help menu, and so forth. It can be downloaded free of cost from http://www.c-point.com/download/csharped.zip. Moreover, the editor comes with built-in tutorials on C#; they can be accessed from the Help menu.
However, it is up to you to decide which editor to use. I recommend you to try one common editor and learn the language in full.
The "Hello C#" Program
A majority of developers learned programming by coding the "Hello World" program. But, for a change, we will see the "Hello C#" program. As mentioned in the previous section, you can use any editor to code the program. It's your preference as to which editor to use. Listing 1 shows the coding for our "Hello C#" program:
Listing 1
using System;
class Hello
{
public static void Main()
{
Console.WriteLine ("Hello C#");
}
}
After entering the above code in an editor, you have to perform the following steps:
- Save the file as Hello.cs. cs is an extension to indicate C-Sharp, as you would use .java for a Java source file. You have to supply this extension when saving your file; otherwise, the code will not compile correctly. The saved file will have the extension .cs.txt.
- Compile the code by giving the following command at the command prompt:
csc Hello.cs
- If there are compile errors, you will be prompted accordingly. Otherwise, you will view a command prompt along with the copyright information, as shown in Figure 4.

Click here for a larger image.Figure 4Compilation and Execution of "Hello C#"
- As a final step, you have to execute the program to view the final output. For that purpose, you simply give a command at the command prompt. Refer to Figure 4. If everything goes well, you can view the message "Hello C#" as shown in Figure 4.
We will analyze the preceding program in detail in the article "C# Program and Its Intermediate Language."
Related Links
- Microsoft .NET Framework SDK
http://msdn.microsoft.com/msdn-files/027/000/976/Search.asp - Download Link
http://download.microsoft.com/download/.netframesdk/SDK/1.0/W98NT42KMeXP/EN-US/setup.exe - SDK on CD-ROM
http://microsoft.order-2.com/developertools - Visual Studio home page
http://msdn.microsoft.com/vstudio - More about Microsoft products
http://shop.microsoft.com
About the Author
Anand Narayanaswamy works as a freelance Web/Software developer and technical writer. He runs and maintains learnxpress.com, and provides free technical support to users. His areas of interest include Web development, software development using Visual Basic, and in the design and preparation of coursewares, technical articles, and tutorials. He can be reached at anand@learnxpress.com.
# # #
More for Developers
On the Codeguru Forums
Visit the Forums »Featured Partner Resources
Get your Android Apps ready for Intel® Atom™ processor-based smartphones and tablets now.
Use the Android NDK to deliver the best performance on Intel® Atom™ processor-based devices.
The Android community on the Intel® Software Network has everything you need to prepare your apps for Intel® Atom™ processor-based devices.



Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.