Delete / hide lines of code entry in Visual Studio

Is there a way to make the visual studio dim or hidden / show query strings as requested by my code?
We use a lot of logging in our project, and it is more difficult to read such code.

I would like it to be like this:

I would like it to be like this, for example:

+8
source share
5 answers

I am using this. We hope that one day they will add color settings and regular expression options for selecting lines:

https://marketplace.visualstudio.com/items?itemName=ElmarXCV.GrayLogLines

+6
source

There is no way to do this from the standard Visual Studio environment. To do this, you will need to define a custom extension that recognizes lines like this marked with it in a specific format and that this format is light colored in the IDE

+1
source

the "hacker" way would be to wrap all the logging in a preprocessor directive, for example

#if DEBUG Log.Info(........) #endif 

Visual-Studio will "smooth" the code inside. and have some kind of configuration header where you

 #define DEBUG 0 

Not the most beautiful, but nice if you don't want the debugging code compiled into your binary. Release

0
source

An unobtrusive code extension worked for me in Visual Studio 2019. It reduces the opacity of the log lines (and the comments that I turned off - I like reading my comments). He quickly updated the nuget package and it works great.

https://marketplace.visualstudio.com/items?itemName=niklaskallander.UnobtrusiveCode

0
source

why don't you put your section in the #region tag.

EG:

  #region Put some region name here for your reference
           Your Code / Comment / Whatever
      #endregion

-3
source

All Articles