Is there a tool or something else to count the number of lines in a specific C# project? Just out of curiosity...
Take one of your existing project, get the number of lines and divide it by the time it took you to code it. This will give you a kind of lines per hour metric. Then, try to estimate how many time you have worked with that specific language and multiply it with your already calculated metric.
Large files tend to do a lot of things and can make it hard following what's going. While there is not an objective maximum number of lines considered acceptable in a file, most people would agree it should not be in the thousands. Recommendations usually range from 100 to 500 lines.
Lines of code are the "source code" of the program, and one line may generate one machine instruction or several depending on the programming language. A line of code in assembly language is typically turned into one machine instruction.
In VS2010 there is a in-built tool that counts all lines of code and other values too: Go to View -> Other Windows -> Code metrics results.
I believe there are tools, but I find it easier to just use the Find in Files option and use this regex:
^~(:Wh@//.+)~(:Wh@\{:Wh@)~(:Wh@\}:Wh@)~(:Wh@/#).+
That regex is from here, which also shows how to search for it. It will return a number of matching lines (i.e. the number of lines in your code)
In Visual Studio 2010 Premium and Ultimate, you can go to the Analyze tab and select "Calculate Code Metrics", it gives you lines of code as well as a maintainability index, cyclomatic complexity, depth of inheritance and class coupling metrics, project by project.
You can drill into namespaces and classes/interfaces as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With