Search code examples
c#visual-studiovisual-studio-2022

What are these teal boxes and how do I get rid of them?


I'm on Visual Studio 2022 happily writing C# code, when I suddenly started getting these teal boxes next to my code:

Unwanted teal boxes

If I click on them, they tell me that my class is implementing some methods or whatever. This is very much useless information, and makes it quite difficult to concentrate.

What are these boxes and how do I get rid of them?


Solution

  • No, it isn't useless information. The fact that you say "or whatever" just demonstrates that you don't understand the information, so how can you declare that it's useless? They provide information and, importantly, navigation for types that implement interfaces.

    If you had clicked one of those icons, you would have seen that there's more information available. If you click the one for the interface, it will show you all the types that implement it. You can click on any one in the list to navigate directly to it. Similarly, clicking one for an interface member will list all the implementations of that member and allow you to navigate directly to them. The reverse is true of the icons for the class and its members, which enable you to navigate directly to the interface and its members.

    This information may not seem important to you, when you have an interface and a class that implements it right next to each other in code. Once you start creating applications of any significant size though, they won't be right next to each other. They will be in different code files and likely in different projects, with multiple classes implementing some of the interfaces. In that case, the information can be important and the navigation definitely is.

    You probably ought to assume a bit less about whether something is important when you have to ask what it actually is. I strongly suggest that you don't get rid of them because, even if you only use them once, they've still served a purpose without causing any harm. I'm guessing that they can be turned off but you may lose other functionality as well. If it can be done though, it will be in the VS Options dialogue. You should have a thorough look through that to see what's available and what else you might want to modify, either now or in the future. If everyone looks through that dialogue for themselves early on, they'll generally have a good idea of where to find something in the future.

    So, I did just look in the VS options. Under Text Editor -> C# -> Advanced, one of the sections is Inheritance Margin and there's an option to show or hide it. I've never seen that before but I had a decent idea of where to look because I've spent some time examining the Options dialogue before to see what's there. Because of that, it took me a couple of minutes to find it. You are just as capable as me of doing those things.