DisableInterrupt in TinyCLR

Is there a DisableInterrupt in TinyCLR, or can someone suggest an alternative?

Would using -= to remove event handler work for you?

Is there a better way then this??

class MyGpioPin
        public GpioPin GpioPin { get; set; }

        public bool IsEnabled { get; set; }

        public void Enable() {
            IsEnabled = true;

        public void Disable() {
            IsEnabled = false;


static MyGpioPin btnTen;

static void Main()
            btnTen = new MyGpioPin();
            btnTen.GpioPin = GpioController.GetDefault().OpenPin(G30.GpioPin.PC0);
            btnTen.GpioPin.ValueChanged += BtnTen_ValueChanged;
            btnTen.GpioPin.DebounceTimeout = TimeSpan.FromMilliseconds(debounceTimeout);

private static void BtnTen_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs e)
            if (e.Edge == GpioPinEdge.FallingEdge)
                if (btnTen.IsEnabled)
                    Debug.WriteLine("TEN BUTTON ENABLED");

Sorry, no that’s even more messy. Too bad the class is sealed, they should make classes partial so we can add functionality.

We usually unsubscribe from the event ValueChanged. Would you work?

Ok, how?
2 methods (subscribe, unsubscribe) for each GpioPin?

Using -=. ?

How do I check for event subscription?

Let us start from the beginning. What are you trying to achieve?