How to convert from Decimal to T?
<p>I've built a wrapper over NumbericUpDown control.
The wrapper is generic and can support int? and double?</p>

<p>I would like to write a method that will do the following.</p>

<pre><code>public partial class NullableNumericUpDown&lt;T&gt; : UserControl where T : struct
{
  private NumbericUpDown numericUpDown;


  private T? Getvalue()
  {
    T? value = numericUpDown.Value as T?; // &lt;-- this is null :) thus my question
    return value;
  }}
</code></pre>

<p>of course there is no cast between decimal and double? or int? so I need to use a certain way of converting.
I would like to avoid switch or if expressions.</p>

<p>What would you do?</p>

<p>To clarify my question I've provided more code...</p>
