title: How to convert object type into float where object can be any type of number like int, long, float, double etc
body: <p>I am having as stream of objects, which can be either type of number like int, short, long, float etc... 
  What is the best way to convert it into a number. Best way could be something
  <code>ToNumber(object oNumber)</code></p>
  
  <pre><code>// Best magic could be
  var number = (somemagic) oNumber;
  
  float operator1 = oNumber is int 
    ? (float)(int)oNumber
    : oNumber is long 
       ? (float)(long)oNumber
       : oNumber is float 
          ? (float)oNumber 
          : (float)(int)oNumber;
  </code></pre>
  
  <p>assuming float will be able to take all number expect double</p>