By redundant stuff, I mean the namespaces, as I know they are necessary but if there are 10k of them, it doesn't add valuable info to the table.
Could this be done using Linq?
To use cloc simply type cloc followed by the file or directory which you wish to examine. Now lets run cloc on it. As you can see it counted the number of files, blank lines, comments and lines of code. Another cool feature of cloc is that can even be used on compressed files.
There are 11 lines of executable code in my C program. So that works out to be 15.2 instructions per line of C for the for the PIC18F; 24.7 instructions for the PIC16F; 9 instructions for the 8051; and 6.2 instructions For the PIC32.
Method 4: Using IndexOf() Method We can also count the number of lines present in the given string using the IndexOf() method.
The SLOCCount tool may help as well. It will give an accurate source lines of code count for whatever hierarchy you point it at, as well as some additional stats. This will print more than one number when there are many files (because wc will be run multiple times. Also doesn't handle many special file names.
No need to reinvent the wheel. Take a look at the Visual Studio Code Metrics PowerTool 11.0
Overview
The Code Metrics PowerTool is a command line utility that calculates code metrics for your managed code and saves them to an XML file. This tool enables teams to collect and report code metrics as part of their build process. The code metrics calculated are:
• Maintainability Index
• Cyclomatic Complexity
• Depth of Inheritance
• Class Coupling
• Lines Of Code (LOC)
I know you said you don't have Ultimate, so I just wanted to show you what you're missing.
For everyone else, there's SourceMonitor
Visual studio will do this for you. Right click on your project and choose Calculate Code Metrics
.
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