According to how you asked this question, it means that you are new to writing software for microcontrollers. Although the .NET Micro Framework exists for them and is supported by C #, the general concept of programming microcontrollers is completely different from programming desktop applications. If you do not want to spend some time studying microcontrollers, I would recommend that you use some USB relay board instead and control the relay directly from your C # application on your desktop, where you feel at home.
You can look at this panel with C # examples or take a look at this SOF Topic, where a similar topic was discussed.
source share