Gray ellipsis VisualStudio 2017 below the keyword

Can someone tell me what VisualStudio 2017 is trying to tell me with this gray ellipsis below the keyword?

Without putting a mouse over it or right-clicking, it does not tell me why this symbol is displayed there.

VisualStudio2017 code image (the gray ellipse is below the "TValue" in the first line of the method)

+5
source share
3 answers

There, the sentence / code refactoring hidden there tells you that what you wrote can also be written in some other form when the same functionality is achieved.

To C # 7, i.e. VS 2017, it was a way of recording, but with C # 7 built-in outputs you can reduce it to

return TryGetValue(key, out TValue value) ? value : defaultValue; 

You can also declare it var , which was not possible before. So you can write it like

 return TryGetValue(key, out var value) ? value : defaultValue; 

How to achieve this

Hover over ... and you will see this sentence in two ways.

  • Press Ctrl + .
    OR
  • A roslyn ball will appear, and you can click on it, and the drop-down menu will offer you the same.
+3
source

It's a hint. Hover over it, give it a second or two, and you will see the Roslyn lamp appear.

In this case, it is probably trying to show you that the C # 7 syntax will allow you to declare inline variables:

 this.TryGetValue(key, out TValue value) ? value : defaultValue; 
+3
source

This is a hint for refactoring.

You can use View.QuickActions (the default keyboard shortcut is: ctrl + . ), While the carriage is above the ellipsis to see which options exist.

0
source

All Articles