1

I have set of .cs files. I want to extract the list of functions from those files.

I want to export the list into a CSV file with the following columns.

FileName FunctionName

Is there any inbuilt tool/utility to do that? or any other quick way (might be using powershell)?

Kara
  • 6,115
  • 16
  • 50
  • 57
Atul Sureka
  • 3,085
  • 7
  • 39
  • 64
  • 1
    If you put doc comments in (type ///) just before the method signature in the cs file. Then you can extract them all in to a nice littel xml file from VS, and then get to a csv from there. Alot easier than writing your own C# parser – Tony Hopkinson Oct 05 '12 at 13:32

1 Answers1

0

There is no built in function in PS, u need to use RegEx. If you have compiled Assembly you could use Get-Member or reflection.

This RE will probably suffice in majority of scenarios:

^[ \t]*(public|protected|private|static).*\([^;]*$

but it could be improved, for instance see this one. For 3thd party tools that can help you see this post.

Community
  • 1
  • 1
majkinetor
  • 8,730
  • 9
  • 54
  • 72