I’m looking for an alternative for CSharpCodeProvider.Parse. The method was supposed to parse a [C#] code source and return a CompileUnit object. However, the method isn’t implemented in any .Net framework.
My purpose is to be able to navigate a C# CodeDOM without having to compile it. I’m writing a application that does some code analysis but I won’t necessarily have all external references, which means I can’t compile it.
SharpDevelop (the open source IDE commonly used for Mono) has a library called NRefactory that allows you to parse C# code and convert it into an AST: http://wiki.sharpdevelop.net/NRefactory.ashx (Excerpt from that link follows):