title: Convert int? to bool in conditional
body: <p>So I created a custom int.tryparse method in c# to try to make things a little easier and cleaner looking. Here is the method:</p>
  
  <pre><code>    public static int? BoolIntParse(string number)
      {
          int temp;
          if (int.TryParse(number, out temp))
              return temp;
          else
              return null;
      }
  </code></pre>
  
  <p>Now, I would like to try to use it in this fashion:</p>
  
  <pre><code>if(int? someNumber = BoolIntParse(someString))
  {
      //do some stuff if its a number
  }
  else
     //throw some error 
  </code></pre>
  
  <p>Which doesn't seem to work. I also tried assigning the value before the condtional such as:</p>
  
  <pre><code>int? someNumber = BoolIntParse(someString);
  if(someNumber)
  {
      //do some stuff if its a number
  }
  else
     //throw some error 
  </code></pre>
  
  <p>And I get the error message <code>Cannot implicitely convert type int? to bool</code></p>
  
  <p>So this isn't legal c#. Is this what a nullible int was designed for (this type of situation) or am I just not doing it correctly? I'm relatively new to c#.</p>