You can remove all your `if`-statements and use [`Convert.ChangeType()`][1] instead. Alternatively, use T4 to generate the code for you and turn it into a `partial` class. *Anything* to avoid duplicating like that. [1]: https://msdn.microsoft.com/en-us/library/dtb69x08(v=vs.110).aspx