I came across a problem and I think I have the solution but cannot find anyone to tell me if I am right or wrong? See sample in C# below:
public void Test(float number)
{
object myObj = number;
//Here is where I don't know what the correct way to do this is?
// int newNumber = (int)myObj;
// int newNumber = (int)(float)myObj;
// int newNumber = (int)(double)myObj;
}
The result has to ensure no type exceptions occur. Any idea's guys?