2

I want to create a simple PushButton class which wraps an InterruptPort. I'd like to give it two simple Up and Down events which are triggered when the port is high and low.

Normally I'd do it like this:

public event EventHandler<EventArgs> Up;
public event EventHandler<EventArgs> Down;

But there's no EventHandler class? How should I do it then?

Svish
  • 152,914
  • 173
  • 462
  • 620

1 Answers1

3

.NET Micro Framework does not support generics, but the non-generic EventHandler is still available.

So you can use it like:

public event EventHandler Up;
public event EventHandler Down;

Namespace: Microsoft.SPOT

Assembly: Microsoft.SPOT.TinyCore (in microsoft.spot.tinycore.dll)

Community
  • 1
  • 1
Nick Hill
  • 4,867
  • 3
  • 23
  • 29
  • What namespace/assembly is that defined in? VS C# 2010 Express just wants me to generate class `EventHandler` when I try that. – Svish Dec 25 '12 at 22:03
  • Aah, there we go. That one wasn't added by default. Thanks! – Svish Dec 25 '12 at 22:09