0

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"

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862

1 Answers1

2

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

cgotberg
  • 2,045
  • 1
  • 18
  • 18