title: Creating a generic method for converting string to nullable numbers
body: <p>I have 3 similar functions, that only change based on numeric type:</p>
  
  <pre><code>&lt;Extension()&gt; _
  Public Function ToNullableShort(ByVal str As String) As Short?
      Dim intReturn As Short
      If Short.TryParse(str, intReturn) Then
          Return intReturn
      Else
          Return Nothing
      End If
  End Function
  
  &lt;Extension()&gt; _
  Public Function ToNullableByte(ByVal str As String) As Byte?
      Dim intReturn As Byte
      If Byte.TryParse(str, intReturn) Then
          Return intReturn
      Else
          Return Nothing
      End If
  End Function
  
  &lt;Extension()&gt; _
  Public Function ToNullableLong(ByVal str As String) As Long?
      Dim intReturn As Long
      If Long.TryParse(str, intReturn) Then
          Return intReturn
      Else
          Return Nothing
      End If
  End Function
  </code></pre>
  
  <p>I was trying to make a generic function out of this, but couldn't do it.  How can I make a generic function that will take a specific T and make it a Nullable(of T)?</p>