Visual Studio counts the number of lines of valid code.
On the Internet, you can see the methods used by others:
Press CTRL + SHIFT + F (Find in files) to check that regular expressions are supported, and enter the search content:
^: B * [^: B #/] +. * $
The above expression statistics can be: # The beginning and/or the beginning of the blank line are not included in the amount of code. If you only need to count the amount of code in the code file, you can select the file type, such as *. xml, *. resx .... Check only *. cs, *. c, *. h...
After searching, the last line is the number of lines of code.
I tried it myself and it was quite helpful. :
Expected result:
Microsoft Visual Studio displays the number of lines of code
Tool-Option-Text Editor-C #-general, just enable the row number.
How does Visual Studio 2010 display the number of lines of code when writing code?
In vs, click the menu tool => Option
Select the row number on the right of "Text Editor" = "all languages = ".