문제

I changed this:

List<string> chapterNames = new List<string>();

...to this:

var chapterNames = new List<string>();

...and was jabbed with this message from the compiler:

"The contextual keyword 'var' may only appear within a local variable declaration"

도움이 되었습니까?

해결책

The simple answer is because that's how Microsoft introduced the var keyword in the specification for .NET 3.0.

http://msdn.microsoft.com/en-us/library/bb384061.aspx

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top