December 2018
by @mw

How to run C# code?

Recently, I have received many questions on how one can run the C# codes to replicate my research results and to extend them to other applications. While C# makes the computations very efficient, it is not the most friendly language for the end users, especially for the ones that have little experience with programming. Nevertheless, the overall process is quite simple and I outline it below. It should work for any OS.

C# programming language is set of commands and structures which make the algorithms intuitive and understandable for humans. Although it is low-level, meaning that its operations are very closely linked to the core computer architecture, the machines cannot understand them instantly. To make the C# programs understandable for your computer, you will need to compile them.

There are multiple C# compilers available, some of them even available online. I typically use the GCC compiler ( It is cross-platform and is very well documented. After you download and install the compiler, you are just a step away from running the C# programs.

Suppose you wish to run the 3-variate sharpened Diks-Wolski test. Firstly, download the
code from, and save it to some directory, say
. Secondly, open either terminal on Mac OS, or command line prompt on Windows (in Start menu type
and hit enter). Navigate to your directory as
cd C:\codes
Thirdly, compile the program by typing
gcc dp3_gaussian.c -o dp3_gaussian -lm
gives the output file and
tell the compiler to use some of the mathematical libraries, which are sometimes given by default. If you see no errors, you may run the executable file, which was created by the compiler, as
On Windows you may need to drop the two escape characters at the beginning and simply execute
On the other hand, if you get compilation errors, read them carefully and try to address the problems being mentioned. Typically they will have to do with wrong paths, file names or permissions in the directory.

Leave your comment

M. Wolski
Marcin Wolski, PhD
European Investment Bank
E-mail: M.Wolski (at)
Phone: +352 43 79 88708

View my LinkedIn profile View my profile
View my IDEAS/RePEc profile  IDEAS/RePEc