How to get all 'ISymbol's from partial class

Topics: APIs
Nov 27, 2014 at 3:05 PM
Edited Nov 27, 2014 at 3:06 PM
Hi, i want to get all methods from a class but i stumbled on partial class and my code is somehow infeasible to get them.

Right now my code looks like this:


Solution solution = ...;
foreach (var project in solution.Projects)
{
 Compilation compilation = await project.GetCompilationAsync();
 foreach (var document in project.Documents)
 {
        SyntaxNode rootNode = await document.GetSyntaxRootAsync();
        SemanticModel semanticModel = await document.GetSemanticModelAsync();
        var typesSyntaxes = from typeSyn in rootNode.DescendantNodes() where typeSyn is TypeDeclarationSyntax select typeSyn;
        foreach (TypeDeclarationSyntax typeSyntax in typesSyntaxes)
        {
            INamedTypeSymbol typeSymbol = semanticModel.GetDeclaredSymbol(typeSyntax);

            typeSymbol.GetMembers(); // Not all members
          }
 }
}


Is there a better way to get all class/type symbols?

Best regards.
Developer
Nov 27, 2014 at 3:40 PM
The type symbol should have all member symbols, even for a partial class.