Microsoft designed the C# language specifically for the .NET framework. C# blends the best of other languages (Java, C++, Pascal) into a powerful language. As a Java developer, I was curious about the release of C#. Unfortunately, the list price of more than $1,000 for Microsoft’s developer environment, Visual Studio .NET, extinguished the appeal. I wanted to play with the language, but I couldn’t afford the investment. Thankfully, I discovered a free .NET development environment called SharpDevelop.
Get your copy
The software is available for download from the SharpDevelop Web site. It is available via the GNU General Public License. The download consists of one file that quickly installs the SharpDevelop software on your machine. The source code is available as well. In this article, we'll use Version 0.88.
Installing the SharpDevelop software requires the Microsoft .NET SDK. SharpDevelop sits on top of the .NET SDK, using its features to provide functionality. Microsoft suggests installing Internet Information Server (IIS) and ADO 2.7 before installing the .NET SDK. Let’s take a closer look at the SharpDevelop IDE features.
Are you ready for more C#?
Check out these Builder.com articles for technical details of the new C# programming language:
- "Gain threading control in C# with the Interlocked and Monitor classes"
- "Stupid C# tricks: Working with indexers"
- "Using asynchronous method calls in C#"
.NET coding simplified
SharpDevelop facilitates the development of C# as well as VB.NET and Java code. The IDE is extensible, so support for other languages is within reach, although we'll focus only on C# here. The IDE was written completely in C#.
The environment facilitates the development of projects and files. Projects are a combination of source files, references, and resource files. A file is a single source file. Figure A provides a glimpse of the SharpDevelop interface.
As you can see, the IDE is divided into three panes: the main pane on the left, along with the code pane and the output pane on the right. The code pane lets you easily view the C# source and the related assembly file. The output pane displays output generated with code execution. Another pane is available for maintaining a task list.
The main pane is divided into four tabs: Projects, Classes, Files, and Tools. The Projects tab shows the current project, with the project class files viewable in the Classes tab. As Figure B shows, the output pane displays the result of compiling the sample class (no compile errors). The Files tab provides access to the file system, and the Tools tab contains extra utilities.
|View the classes and compile results.|
Adapt to your style
One of the best aspects of SharpDevelop is its flexibility. You can easily customize both the IDE and individual projects to fit your developer tastes. For example, the Options window is available from the main Tools drop-down. This window allows you to set the language (see Figure C), font, code indentation, external tools, and numerous text editor options.
|IDE options: Selecting the language|
One IDE feature that all developers love is code completion—a pop-up list of methods and/or properties available for objects typed into the code pane. The list appears after you enter a period for the object, signaling method or property selection. Figure D shows the available list for the System.Console object. If you're not a fan of code completion, you can disable it through the Options window.
|Code completion feature|
Let the code work for you
Once you've entered your code, it's easy to compile using the Run menu. Figure E shows the compile options. Any build errors encountered are displayed in the output pane. The building of the project creates the application's executable (exe) file, which is placed in the output path specified in the Project Options window. Figure F shows the output path I specified for my test project.
|SharpDevelop compile options|
|Project Options: output path|
You also select the output type in the Project Options window. You can set it to WinExe, library, or exe. For my project, I chose exe. The file (exe) is easily executed from a command prompt or by double-clicking on the file in Windows Explorer.
The SharpDevelop environment makes it easy to produce documentation as well. The C# style comments aid the process. The Generate Documentation and HTML Export options available via the Project menu selection facilitate the generation of documentation as HTML files. These files contain assembly and source code information, along with a main index file.
SharpDevelop is not the only Visual Studio .NET alternate on the market, although it offers a flexible and easy-to-use environment—and you can't beat the price tag. A quick Internet search will yield a number of results. All the alternatives can use the command-line interface available with the Microsoft .NET SDK with no problems. If you'd like additional info on alternate .NET languages, check out this article.
What are you waiting for?
The C# language is here to stay, and thanks to the free SharpDevelop IDE, it costs nothing to start developing C# code. The version used in this article is still a beta, so be sure to monitor the Web site to catch new releases.
Are you actively working with C#?
Have you jumped onto the .NET bandwagon, or are you just curious about C#? Let us know your thoughts. Post a comment in the discussion below or send us an e-mail.