I
think that perhaps this question is better suited on
CodeReview, but my first step to optimize the run time performance on this would be to measure where the hotspots are. Make sure to include all the code that is using it as well, you might even find that the biggest gain in run time performance would be somewhere else completely. Also, do you really
need it to be generic, could you do with a
ConvertToByte
,
ConvertToInt32
, etc.? —
Lasse V. Karlsen 1 min ago