Interaction of var
, nameof
, and Color Color
#832
Labels
type: bug
The Standard does not describe the language as intended or implemented
Milestone
C# 7 draft §13.6.2 (Local variable declarations) says this about "implicitly typed local variable declaration":
As specified and implemented, this disallows also
var x = nameof(x);
even though the type of the expression would be unambiguous in this case. That was discussed in dotnet/roslyn#766 and C# Design Meeting Notes for Mar 4, 2015.However, the wording "refer to the declared variable" seems a bit ambiguous in the "Color Color" case (C# 7 §12.8.7.2, Identical simple names and type names).
In the following example, does
nameof(Color.Beige)
refer to the variable, the type, or both?(Continued from #831 (comment))
The text was updated successfully, but these errors were encountered: