Home Programming Get started with C Sharp

Get started with C Sharp

by shedboy71

Before I start I will say that this isn’t going to be some petty post that spends lots of time justifying and then putting down other programming languages. I’ve used C# and many other languages and I personally have no real favourites. In this example we will install a text editor on our Raspberry Pi and then the development tools required to program in C#

First of all its good practice to update and upgrade first, open up the terminal and type in the following

sudo apt-get update
sudo apt-get upgrade

I quite like the geany editor there are other alernatives as well, to install this type in the following on the console

sudo apt-get install geany

Now lets install the Mono development tools required to program in C#, again at the console type the following

sudo apt-get install mono-complete

Now we will created a folder for our code called HelloWorldCs, we will navigate to that folder and then create a file in geany called HelloWorldCs.cs. In the terminal enter this

mkdir HelloWorldCs
cd HelloWorldCs
geany HelloWorldCs.cs

This will open geany now enter the following code and save it


using System;
public class HelloWorld
public static void Main()
Console.WriteLine("Hello Raspberry Pi!");


Compile this with the following

gmcs HelloWorldCs.cs

Now run the executable

mono HelloWorldCs.exe


You should see something like the following, don’t worry it will get more exciting …. hopefully.

C sharp on pi

C sharp on pi

You may also like