Логика выбора перегруженного метода
Учитывая следующие перегруженные методы:
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!";
}
Когда я звонюTest()
, передаваяshort
, нравится:
short shortValue = 7;
var result = Test(shortValue);
Почему ценностьresult
равно"Test with an int was called!"
, вместо"Test with an object was called!"
?