Display line numbers in the editor
This article describes how to show or hide line numbers in your code.
On the Visual Studio menu bar, select Tools > Options > Text Editor, and then select either the language you're using or All Languages. All Languages turns line numbers on or off in all supported programming languages.
You can also type line number in the Visual Studio Search box, and then select Turn line numbers on or off in the results.
Select the Line numbers checkbox to show line numbers, or clear the checkbox to hide line numbers.
Note
Line numbers aren't added to your code. They're just for reference.