C # is a great programming language and all the tools you need to start using it are free and easy to use. While Visual C # is associated with Microsoft and is a closed source project, supporters of free software and open-source projects use DotGNU which provides more or less the same basic tools, while giving you the opportunity to study and modify how the program works. without any restrictions. The instructions in this guide describe both approaches: "FOSS oriented" and "Windows oriented". The C # language also exploits all the potential of the. NET framework.
Steps
Method 1 of 4: Configure Windows Environment
Step 1. Go to the following website and download your free copy of Visual C # 2010 Express Edition
The 2012 version is also available, if you don't have specific development needs you can opt for the 2010 version of Visual C #.
The Visual C # 2012 version is only supported on Windows 7/8
Step 2. Run the file you just downloaded and follow these instructions:
-
Press the Next button.
-
Accept the terms of the agreement and press the Next button.
-
Select the installation of the MSDN library, not the SQL Server, then press the Next button.
-
Press the Install button.
Method 2 of 4: Create Your First Program
Step 1. Launch Visual C # 2010 Express Edition
Step 2. Access the File menu and select the New Project item
Step 3. Select the Visual C # entry, choose the Windows option and finally select the Console Application object
Step 4. When done, press the OK button
You should see the following code:
using System; using System. Collections. Generic; using System. Text; namespace ConsoleApplication1 {class Program {static void Main (string args) {}}}
Step 5. Under the static void Main (string args) piece of code, after the first opening brace, type the following code:
Console. WriteLine ("Hello, World!"); Console. ReadLine ();
Step 6. The complete program should look like this:
using System; using System. Collections. Generic; using System. Text; namespace ConsoleApplication1 {class Program {static void Main (string args) {Console. WriteLine ("Hello, World!"); Console. ReadLine (); }}}
Step 7. Press the Start [►] button on the toolbar
Congratulations! You just created your first C # program!
Step 8. The result is a Windows shell window in which the classic Hello World
-
If not, you most likely made a typo, double-check the code carefully.
Method 3 of 4: Configure Linux Environment
Step 1. You need to use CVS and GNU tools
These are two programs that should be included in most Linux distributions.
Step 2. Access the DotGNU project site (https://www.gnu.org/software/dotgnu/) which provides the FOSS implementation of C #
Read the chapter on installation instructions. This is a simple procedure that can be performed even for a beginner.
Step 3. You can choose to download the source code and build the C # development environment from scratch, or use a pre-compiled distribution
The project is relatively simple to create via source code, so I recommend that you go this route.
Step 4. Try to start with one of the sample codes included in the pre-compiled version of the development environment
For example, the FormsTest.exe program displays a large collection of GUI interface controls. The pnetlib / samples folder contains the ilrun.sh script with which to start precompiled executable programs. In our example the command is the following sh./ilrun.sh forms / FormsTest.exe (to be launched inside the folder).
Step 5. On Linux you can use the KWrite or gedit commands to edit the C # code
Newer versions of both editors allow you to highlight the syntax elements for this programming language.
Step 6. Find out for yourself how to compile the sample code provided in the Windows environment method
If the project website doesn't provide enough documentation on this, try a Google search. If that doesn't help, send your questions to the project mailing list.
Step 7. Congratulations, you now have two C # development environments
In this way you can consciously choose which one is the most suitable for your needs.
Method 4 of 4: Recommended Books
- ISBN 0-7645-8955-5: Visual C # 2005 Express Edition Starter Kit - Newbie
- ISBN 0-7645-7847-2: Beginning Visual C # 2005 - Novice
- ISBN 0-7645-7534-1: Professional C # 2005 - Intermediate +
Advice
- Visual C # 2005/2008 Express Edition comes with an installation option that allows you to add the Microsoft MSDN 2005 Express Edition library. This is a great source of information that you can access via the program Help or by highlighting a code keyword and pressing the F1 key. Installing the MSDN library is a highly recommended step.
- If you install Visual C # 2010/2012 Express, it will automatically download or give you the option to do so.
- There are better implementations of C # than the ones shown in this guide. The Mono project could be very interesting for you.