Trying to set the C# lang version that Razor uses via the RazorViewEngineOptions.ParseOptions is a less-than-optimal experience right now, as the Roslyn types are immutable.
The following doesn't compile as ParseOptions.LanguageVersion is not settable:
services.AddMvc().AddRazorOptions(options => options.ParseOptions.LanguageVersion = LanguageVersion.CSharp7);
The IntelliSense leads you down a path where this looks like what you should do, but it doesn't work, because WithLanguageVersion returns a new instance of ParseOptions which gets lost to the ether:
services.AddMvc().AddRazorOptions(options => options.ParseOptions.WithLanguageVersion(LanguageVersion.CSharp7));
This is actually what you need to do:
services.AddMvc().AddRazorOptions(options => options.ParseOptions = new CSharpParseOptions(LanguageVersion.CSharp7));
Or probably more correctly:
services.AddMvc().AddRazorOptions(options => options.ParseOptions = options.ParseOptions.WithLanguageVersion(LanguageVersion.CSharp7));
Not really sure we can do anything about this given the types are designed this way.