前面输出 变量 a ,系统会进行隐式的类型转换。但是使用表达式树调用方法,要对应类型才行,以便找到正确的重载方法。上面的表达式树调用 Console.WriteLine() 会报如下错误:
1
System.ArgumentException:“Expression of type 'System.Int32' cannot be used for parameter of type 'System.String' of method 'Void WriteLine(System.String)'