UPDATE: you'll probably need to recompile the library from source, read here for instructions.
So, here are some instructions for using libpigpio, the shared GPIO library for the Raspberry Pi in a C# program. First, get libpigpio by downloading it from here.
Unzip it and copy the file called libpigpio.so to the /lib folder on your Raspberry Pi. You'll need elevated privileges to do that, so you'll probably type something like:
sudo cp libpigpio.so /lib
.
Alternatively, you could compile the library yourself by copying the libpigpio.c file to the Raspberry Pi and using the commands listed inside the file to compile and copy it to /lib.
Once libpigpio.so is in the /lib folder the library is installed and ready to use. We can now begin programming in C#. I'm using MonoDevelop on another machine, I expect you'd probably do something similar. Create your new C# project, and add the RpiGpio class found in RpiGpio.cs or just copy and paste the code from my previous blog entry. This is the wrapper that allows the shared library to be used in C#. Now we can write some C# code to access the GPIO.
This is an example test program:
using System;
using System.Threading;
using LibPiGpio;
namespace RPiBlinky
{
class Program
{
static void Main(string[] args)
{
int inc = 1, t = 7, last = 0;
RpiGpio.SetOutputPins(new[] { 7, 8, 9, 10, 11 });
while (!Console.KeyAvailable)
{
if (last != 0)
{
t = t + inc;
if (t >= 11 || t <= 7) inc *= -1;
RpiGpio.Pins[last] = false;
}
RpiGpio.Pins[t] = true;
last = t;
Thread.Sleep(250);
}
Console.ReadKey();
}
}
}
If you want to test your code, you can uncomment the #define NOPI
in RpiGpio.cs, which will allow you to run the code on something other than a Raspberry Pi. For example, here is the test program running like that on my virtual machine:

When you're happy with your code (making sure that you've re-commented the #define
in RpiGpio.cs) simply copy the compiled C# executable to your Raspberry Pi and run it like this:
sudo mono GPIOtest.exe
.
But replace GPIOtest.exe
with the name of your Mono executable. You'll need to use sudo for the program to have enough permission to access the GPIO. That's it! It's quite a simple process really.
Please check everything I've said, you can't hold me responsible if you break your own stuff. Always double check your electronic connections, that will help you not to break stuff too. It's always best to check the source code and compile it yourself before you use it. But have fun, it's good to build stuff.