How to Automatically Cast Between Types in C#