How to convert object type into float where object can be any type of number like int, long, float, double etc

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 ToNumber(object oNumber)

// 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;

assuming float will be able to take all number expect double

Jon Skeet
people
quotationmark

I believe Convert.ToSingle will be able to handle any "core" numeric type you throw at it.

people

See more on this question at Stackoverflow