C# Logic Gates

Logic gates

From the humble logic gate came the CPU. The CPU begat machine code, machine code begat assembler, assembler begat C, C begat the Windows API and finally the Windows API begat the .NET Framework. So to come full circle, I thought I'd implement logic gates on top of the .NET Framework.

I've implemented OR, AND, XOR and NOT gates, along with a switch for setting inputs and a light for seeing outputs. Just place the gates on the VS.NET forms designer and hook them up through their properties.

It's now 2024 and remarkably this still works in the latest version of Visual Studio. I imagine there are much better implementations of this kind of thing available but impressive backwards compatibility from Microsoft

Download the source and compiled DLL here

To Do

  • Cope with gates whose output leads back to their input. This currently causes a stack overflow...
  • Hide controls that shouldn't be used (Device, OneInputDevice and TwoInputDevice)
  • Repainting in the IDE isn't very good currently.