C Sharp

C# is an object-oriented programming language created by Microsoft for their .NET framework. It was created as their answer to C++ (the # represents four +s in a 2x2 grid and sharp meaning higher in pitch) but it is often compared to Java since they both have similar syntax and run on virtual machines. In recent years, C# has become a very common language for gamedev in both indie and AAA video games.

Pros and Cons


  • Widely used in the game industry
  • Easier to learn and use compared to C++
  • Compatible with C/C++ via DLLs
  • Wide amount of frameworks and engines
  • Limited functional-programming support
  • Portable - Runs on any platform that .NET/Mono supports
  • Supports GOTO control flow unlike Java
  • Supports multi-dimensional arrays unlike Java
  • Supports structs in addition to classes
  • Supports pointers unlike Java
  • Supports multiple classes in the same source file
  • Supports in-line assembly
  • Built in XML parser


  • Practically forces you to use an IDE for large projects due to lack of import/include statements
  • No multiple inheritance for classes
  • Being a virtual machine based language means that programs will run slower than if they were native applications
  • No way to compile to native applications
  • Despite there being open source implementations of C# like Mono and open source frameworks like MonoGame. C# is pretty much frowned upon in the FLOSS community due to concerns with patents from Microsoft.

.NET vs Mono

C# programs run on a virtual machine. The virtual machine that C# was intended for was the .NET runtime by Microsoft. Thus it is only targeted at Microsoft platforms (except for .NET Core which is licensed under MIT). However, an open source implementation of .NET exists called Mono. Mono tries to replicate all the functionalities of the .NET framework without patent infringement and is cross-platform. For the most part, .NET and Mono applications are compatible with each other, so you never really need to worry about it, but this is still something worth pointing out.

Supported tools








Online C# Coding/Compile

  • C# Pad - Fast, simple format, and has autocomplete.
  • .Net Fiddle - Fast, full format, has autocomplete, and can import nuget packages.

Libraries/NuGet Packages

  • JSON.NET - JSON parser for C#
  • Curses Sharp - C# wrapper for the curses library
  • Nlua - C# library that allows you to run Lua scripts in your programs

Sample code

Hello World

using System; //  Namespace for essential datatypes

namespace Program {
    class MainClass {
        public static void Main(string[] args) {
            Console.WriteLine("Hello, world!");


using System;

namespace Program {
    class MainClass {
        public static void Main(string[] args) {
            for (int i = 0; i <= 100; i++) {
                if ((i % 3 == 0) && (i % 5 == 0)) {
                else if (i % 3 == 0) {
                else if (i % 5 == 0) {
                else {

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License