title: C# short if statement
body: <p>Is there a way to do this in C# without making a new method to overload for every var type there is?  </p>
  
  <pre><code>$box = !empty($toy) : $toy ? "";  
  </code></pre>
  
  <p>The only ways I can think of to do it is either:</p>
  
  <pre><code>if (toy != null)
  {
      box += toy; 
  }  
  </code></pre>
  
  <p>or this:  </p>
  
  <pre><code>public string emptyFilter(string s) ...
  public int emptyFilter(int i) ...
  public bool emptyFilter(bool b) ...
  public object emptyFilter(object o) 
  {
      try 
      {
          if (o != null)
          {
              return o.ToString(); 
          }
          else 
          {
              return ""; 
          }
      }
      catch (Exception ex)
      {
          return "exception thrown": 
      }
  }
  
  box += this.emptyFilter(toy);
  </code></pre>
  
  <p>I basically wanna check to make sure that the variable/property is set/not empty/exists/has value/etc... and return it or "" without some ridiculous about of code like above. </p>