Switch pin mode

How do I set an InputPort pin to become an OutputPort pin, and vice versa?
Or if that isn’t possible, how can I simply reset a pin so that I can create a new InputPort object using it?

Look at the TristatePort:

And some code: http://www.tinyclr.com/forum/2/3549/

Is this for RLP, ie C/C++?

For RLP, if you include RLP.h then you can call:

RLPext->GPIO.EnableOutputMode(Pin,0);

or

RLPext->GPIO.EnableInputMode(Pin,RLP_GPIO_RESISTOR_DISABLED);