tags:

views:

95

answers:

1

Has anyone used Powershell to generate a report of C# classes versus methods and properties? I'll admit up front I'm not attempting first to write this myself, but someone out there has probably already done it, or would highly enjoy doing it. The challenge will be recognizing things like method signatures across multiple lines. You could join the string array returned by gc and search on that to make it easier. If no one answers, I'll eventually post a solution, but probably many weeks from now.

Update: I'm looking for a Powershell solution because that's already my main scripting language, and I'd like to be able to make changes over time, perhaps extend it to cover JavaScript for example, or change the report format, and I'd like it to work with any version of Visual Studio and C#. I'm also looking for a text report, nothing graphical, so that it's more searchable and manipulatable. I like simple fully programmable free things that impose no limits. :)

Thanks,
Mike

+3  A: 

I'm sure you can access Reflection through PowerShell.

You should also look into NDepend, which can do a lot of this sort of thing.

John Saunders
Reflection through PowerShell: Certainly can.
Richard
These are definitely good answers, just not what I'm looking for. I'm looking for a simple Powershell solution, and doubt it will even require very many lines of code. I'll post the answer myself in time, a month or three, if someone else does not. Most likely it will recognize and collect all methods arguments, and properties, per class, then make a second pass and list what calls what, just one level down. Not looking for anything deep or complicated. I create simple ERDs sort of like this in SQL, (this table.column references that table.column), very simple but quite useful.
Mike
Nor is reflection very fun or concise. Pattern matching is both. :)
Mike