public void HandleCollision(Collidable with) { Type collisionTargetType = with.GetType(); CollisionAction action; bool keyFound = collisionTypes.TryGetValue(collisionTargetType, out action); if (keyFound) { action(with); } }