Given the following overloaded methods:
public string Test(long item)
{
return "Test with a long was called!";
}
public string Test(int item)
{
return "Test with an int was called!";
}
public string Test(object item)
{
return "Test with an object was called!";
}
When I call Test()
, passing a short
, like this:
short shortValue = 7;
var result = Test(shortValue);
Why is the value result
equal to "Test with an int was called!"
, instead of "Test with an object was called!"
?