Is there a tool or something else to count the number of lines in a specific C# project? Just out of curiosity...
Is there a tool or something else to count the number of lines in a specific C# project? Just out of curiosity...
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)
Visual Studio does that if you use its "Code Analysis" tool.
Edit: a 10-second google search (with the terms sloc count c#) returns this Code Project article: http://www.codeproject.com/KB/files/directorylinecounter.aspx
I've had good success with David Wheeler's SLOCCount. It's a command line tool, which will require Cygwin unfortunately, but I found it handled very large Java projects without fuss. C# is listed as a supported language for counting. Configuration is minimal, IIRC I just pointed it at a directory and it summarised all the type of code and broke it down in lines per language.
Highly recommended.