Reading the state of a pin in C#

Thank you both now i have something to work with.