Space Invaders Clone

Tue Oct 30 2012 14:30:00 GMT+0000 (Coordinated Universal Time)

A 100% true-to-the-original Space Invaders clone

C# Raising events using reflection

Sat Oct 20 2012 03:19:00 GMT+0000 (Coordinated Universal Time)

/// <summary>
/// Raises the specified event by name.
/// </summary>
/// <param name="eventName">Name of the event.</param>
/// <param name="eventArgs">The <see cref="EventArgs" /> instance containing the event data.</param>
public void Raise(string eventName, EventArgs eventArgs)
  // Get the event field info
  var fieldInfo = this.GetType().GetField(eventName, BindingFlags.NonPublic | BindingFlags.Instance);
  // If the event exists
  if (fieldInfo != null)
    var eventDelegate = (MulticastDelegate)fieldInfo.GetValue(this);
    // If there's any subscribed events...
    if (eventDelegate != null)
      // Invoke their raise methods
      foreach (var handler in eventDelegate.GetInvocationList())
        handler.Method.Invoke(handler.Target, new object[] {this, eventArgs});

Conclusion of the QR-on-the-back-of-my-shirt experiment

Fri Aug 03 2012 17:21:00 GMT+0000 (Coordinated Universal Time)

After extensive field testing in the midst of central Stockholm with a QR-code the size of a football on the back of my shirt, I’ve come to the conclusion that Swedes are shy beings who won’t even take a photo of someone (even if nobody is looking) to satisfy their curiosity.

My personal portfolio of things I come up with when I'm bored.