How to Create a Program in C Sharp
C# is a great programming language, and all the tools you need to get started are free and easy to use. While C# is usually associated with Microsoft and closed source, free software supporters just use DotGNU that delivers more or less...
Part 1 of 3:
Seting Up (Windows)
-
How to Create a Program in C Sharp Picture 1
Go here to download your free copy of Visual C# Community Edition. -
How to Create a Program in C Sharp Picture 2
Run the downloaded executable and follow these steps:- Next.
How to Create a Program in C Sharp Picture 3
- I agree → Next.
How to Create a Program in C Sharp Picture 4
- Select MSDN, not SQL → Next.
How to Create a Program in C Sharp Picture 5
- Install.
How to Create a Program in C Sharp Picture 6
- Next.
Part 2 of 3:
Creating Your First Program
-
How to Create a Program in C Sharp Picture 7
Run Visual C# Community Edition. -
How to Create a Program in C Sharp Picture 8
Go to File → New → Project. -
How to Create a Program in C Sharp Picture 9
Select Visual C# → Windows → Console Application. -
How to Create a Program in C Sharp Picture 10
Press OK. You should see this:using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { } } }
-
How to Create a Program in C Sharp Picture 11
Beneath static void Main(string[] args), after the first curly brace, type:Console.WriteLine("Hello, World!"); Console.ReadLine();
-
How to Create a Program in C Sharp Picture 12
Make sure it looks 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(); } } }
-
How to Create a Program in C Sharp Picture 13
Click the Run [►] button on the toolbar. This will build the program and run the program. Congratulations! -
How to Create a Program in C Sharp Picture 14
View the result. This should have produced a console window, reading Hello World!- If it did not, then you did something incorrectly.
Part 3 of 3:
Setting Up (Free Software)
-
How to Create a Program in C Sharp Picture 15
Download CVS and GNU build tools. This should be included into the majority of Linux distributions. -
How to Create a Program in C Sharp Picture 16
Go to the DotGNU project (http://www.gnu.org/software/dotgnu/) that provides FOSS implementation of C#. Read the chapter about the installation. These instructions are simple to follow even for beginners. -
How to Create a Program in C Sharp Picture 17
Decide if you want to get the source code and build you C# environment from scratch or you may try pre-compiled distributions first. The project is relatively easy to build from the source so we suggest to try this way first. -
How to Create a Program in C Sharp Picture 18
Try to start some examples that also come in precompiled (.exe) form. For instance, FormsTest.exe will show large collection of various GUI controls. The folder pnetlib/samples contains the script ilrun.sh that can launch precompiled executables, for instance sh ./ilrun.sh forms/FormsTest.exe (from inside that folder). -
How to Create a Program in C Sharp Picture 19
Use KWrite or gedit to edit the C# code - the recent versions of both editors support the syntax highlight for this language. -
How to Create a Program in C Sharp Picture 20
Figure out yourself how to compile the short example, given in the "Windows way" section. If the project web site does not provided enough documentation, try web search. If this does not help, post questions to the project mailing lists. -
How to Create a Program in C Sharp Picture 21
Congratulations, you are both C# - aware and not bound to any single C# provider!
5 ★ | 1 Vote
You should read it
- Expand the OLPC computer sponsorship program
- How to set up a website with Project Shield: DDOS prevention service from Google
- Toshiba will be the main supplier for Project Ara
- Revealing secrets hidden by the CIA for decades
- What is Microsoft Management Console (MMC)? Steps to use Microsoft Management Console
- How to import Recovery Console in Windows XP?
- Google launched DDoS 'unique'
- Install and use Recovery Console in Win XP
- Documenting a Rust project with mdBook
- Google's Android Silver project is postponed indefinitely
- It is about time to 'every child a computer'
- Latest Project XL code and how to enter Project XL code