Implementing an implicitly declared variable compiles but does not support Visual Studio

Consider the following scenarios:

Works:

SemanticModel semanticModel;
document.TryGetSemanticModel(out semanticModel);

Does not work:

var semanticModel;
document.TryGetSemanticModel(out semanticModel);

Works:

document.TryGetSemanticModel(out SemanticModel semanticModel);

It works, BUT:

document.TryGetSemanticModel(out var semanticModel);

But : the code compiles, but when you hover over there is no intellectual information or documentation. Is the last method considered syntactic sugar for the second (which causes the error below) or is it more than simple?

Implicitly typed variables must be initialized

So, am I looking at an error in implementation or in Visual Studio?

+4
source share
1 answer

, , , # 6. , Roslyn , intellisense .

, Visual Studio?

, , "" ( , ) , Visual Studio. Roslyn Codebase.

+2

Source: https://habr.com/ru/post/1537792/


All Articles