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 w
A custom-made parser will be the best option. As Blair stated in the comment to StingyJack, it is VERY difficult to parse code with regex. I've attempted it once, and, although it is possible to match balancing braces with NET, escaping comments and strings is much more complicated.
A parser should make things much simpler. See antlr for a good generator.
As for reflection, I believe you could attempt to compile the code (as long as you have all necessary dependencies) and then access it contents Reflector-like. But I'd go with the parser.