I have a requirement to get the contents of every method in a cs file into a string. What I am looking for is when you have an input of a cs file, a dictionary is returned with the method name as the key and the method body as the value.
I have tried Regex and reflection with no success, can anyone help?
Thanks
I don’t know if it’s any use to you but Visual Studio Addins include a EnvDTE object, that gives you full access to the VB and C# language parsers. See Discovering Code with the code Model
I touched on it tangentially years ago, I don’t know how difficult it is to use, or how effective it is, but it does look like it will give you what you need.
If you read the article in full it tells how to pull the full text from a file for a function
Hope this helps 🙂