I had the same problem with a declared variable named endingYear.
Declared here:
public ChartData(MetricInfo metricInfo, MetricItem[] metricItems) : this() { int endingYear = 0;
Further along in the method this was not a problem:
endingYear = endingDate.Year;
But when I referenced the very same varable in a Case statement I got the "Cannot use local variable before it is declared" error even thou the variable was in intelesense:
case "QRTR_LAST_FULL_QRTR": if (metricInfo.CalendarType == "CALENDAR") { switch (endingDate.Month) { case 1: case 2: case 3: loopControl = 4; endingYear = endingDate.Year - 1;
Based on Matt's result I tried changing the variable name to endYear and the problem went away. Very strange and a waste of a half hour or so. If it was not for this thread of posts it probably would have been a bigger time loss.