Skip to content

Instantly share code, notes, and snippets.

@Virtlink
Virtlink / TypeSwitch.cs
Last active March 9, 2019 17:11
Switch on type. The order of the Case() methods is important.
using System;
namespace Virtlink
{
/// <summary>
/// Executes a particular piece of code based on the type of the argument.
/// </summary>
/// <example>
/// Usage example:
/// <code>
@TinkerWorX
TinkerWorX / AwesomiumComponent.cs
Created May 13, 2012 22:20
An XNA compatible Awesomium component.
JCPM_MWX.Awesomium.Xna
{
public class AwesomiumComponent : DrawableGameComponent
{
private delegate Int32 ProcessMessagesDelegate(Int32 code, Int32 wParam, ref Message lParam);
private static class User32
{
[DllImport("user32.dll", SetLastError = true)]
internal static extern IntPtr SetWindowsHookEx(Int32 windowsHookId, ProcessMessagesDelegate function, IntPtr mod, Int32 threadId);