private static string UID  = "XYZ";    // Change XYZ to the UID of your Joystick Bricklet 2.0

    static void Main()
    {
        IPConnection       ipcon = new IPConnection();                 // Create IP connection
        BrickletJoystickV2 j     = new BrickletJoystickV2(UID, ipcon); // Create device object

        ipcon.Connect(HOST, PORT);                                     // Connect to brickd
        // Don't use device before ipcon is connected

        // Get current position
        short x, y;

        j.GetPosition(out x, out y);

        Console.WriteLine("Position [X]: " + x);
        Console.WriteLine("Position [Y]: " + y);

        Console.WriteLine("Press enter to exit");
        Console.ReadLine();
        ipcon.Disconnect();
    }