title: How do I implement interrupt in micro framework?
body: <p>I can't compile code for <code>stm32f4discovery</code> in .NET with VS2010.</p>
  
  <p>Using <code>NETMF 4.2</code></p>
  
  <pre><code>    using System;
      using System.Threading;
      using Microsoft.SPOT;
      using Microsoft.SPOT.Hardware;
  
      namespace MFConsoleApplication1
      {
  
          public class Program
          {
              private static InterruptPort interruptPort;
  
              public static void Main()
              {
                  interruptPort =  new InterruptPort(Cpu.Pin.GPIO_Pin2,
                                                 false,
                                                 Port.ResistorMode.PullUp,
                                                 rt.InterruptMode.InterruptEdgeLevelLow);
  
                  interruptPort.OnInterrupt += new NativeEventHandler(port_OnInterrupt);
  
  
                   Thread.Sleep(Timeout.Infinite);
              }
  
  
               private static void port_OnInterrupt(uint port, uint state, TimeSpan time)
               {
                  Debug.Print("Pin=" + port + " State=" + state + " Time=" + time);
                  interruptPort.ClearInterrupt();
               }
           }
      } 
  </code></pre>
  
  <p>On compilation, I receive the following error: 
  <code>No overload for 'port_OnInterrupt' matches delegate 'Microsoft.SPOT.Hardware.NativeEventHandler'</code></p>
  
  <p>How  I can compile the code?</p>
  
  <p>I've took this example from book "Expert .NET Micro framework".</p>