This is my first stack, so if I am not posting correctly, or without flagging right or anything else, please let me know.
For the curious, at the end of this question there is a little background on why I want to do this.
I hope someone has ideas on how I can easily take a code file and then get an array of strings with each element of the array containing the contents of one method from this code file.
What I want to do is easily parse the .Net code file into it indivdial. Reading a file from disk is pretty simple - parsing, so I have separate lines for each method is what I'm looking for for a better method. The code files I will go through is VB, but ideally I would like to see that this works with C #. For the VB side, moving along each line, looking for the method declaration keywords, then the next instance of "end sub" and "end function" should work, but this is not easy to translate into C #. I also cannot overcome this feeling that there must be a better way - perhaps through reflection.
Now for the background: I recently discovered that when Windows forms are called with .ShowDialog, the resources are not cleared after you are done with the form - you must specifically get rid of it. This was discovered by tracking memory leaks in the application I'm working on. Therefore, I need to track every instance where showdialog is called, and dispose is not called. A code search shows that I have over 300 instances of showdialog. It’s a little tedious to go through each one and find out if the form is set up correctly. If I have lines of all methods, I can just search for methods that include showdialog and not destroy. This will give me a very focused direction to clear these things, and also give me a tool that I can run regularly and find any place that may have entered it back into the code.
. .