Could you explain in a detailed manner why the expected result is not correct? As most of the readers expect that the output is Byte Char Int Byte
, but of course it is not the correct answer.
using System;
class Tester {
public static string test(byte b) {
return "Byte ";
}
public static string test(char c) {
return "Char ";
}
public static string test(int i) {
return "Int ";
}
public static void Main(String[] args) {
byte b = 0;
char c = 'A';
Console.Write(test(true ? b : c));
Console.Write(test(false ? b : c));
Console.Write(test(true ? 0 : 'A'));
Console.Write(test(false ? 'A' : (byte)0));
}
}
The correct result is Int Int Int Int
.