not exact "7.13 The null coalescing operator" in C# 4.0 spec
in "7.13 The null coalescing operator" of C# 4.0 spec, it says
Otherwise, if b has a type B and an implicit conversion exists from a to B , the result type is B.
By my understand, it should be from A0 to B (A0 is the underlying type of A if A is a nullable type, or A otherwise).
int? a=null;
long b=5;
then type for a??b
is long, because an implicit conversion exists from int(namely A0) to long.
please help confirm whether my view is correct.
in C#3.0 it says:
Otherwise, if an implicit conversion exists from A0 to B, the result type is B.
in my guess, it may be a typo in C#4.0.
链接地址: http://www.djcxy.com/p/57964.html上一篇: 用null进行隐式转换