Search code examples
c#visual-studio-2017intellisensevarc#-7.0

Why doesn't C# VS2017 intellisense work with var and local functions?


Why doesn't Intellisense work if I do something like this.

enter image description here

It does work though if I explicitly declare Foo

enter image description here


Solution

  • The problem reproes. It is a problem with parsing incomplete code.

    The line that you started (foo.) gets parsed together with the local function on the line below. This causes the local function not to be parsed correctly, so VS doesn't know that GetFoo is a local function any more or that it returns a Foo.