Methods from Partial Class

Viewed 150

I'm using the tangible T4 example from the documentation and pull the classes as followed:

// get all class items from the code model
var allClasses = VisualStudioHelper.CodeModel.GetAllCodeElementsOfType(project.CodeModel.CodeElements, EnvDTE.vsCMElement.vsCMElementClass, false);

And the methods:

// get all methods implemented by this class
var allFunctions = VisualStudioHelper.CodeModel.GetAllCodeElementsOfType(codeClass.Members, EnvDTE.vsCMElement.vsCMElementFunction, false);

Here is how I initialize project and codeClass:

var project = VisualStudioHelper.GetProject("CodeBase");
var allClasses = VisualStudioHelper.CodeModel.GetAllCodeElementsOfType(project.CodeModel.CodeElem‌​ents, EnvDTE.vsCMElement.vsCMElementClass, false); 

foreach(CodeClass codeClass in allClasses) { ..... }

This works except that I don't get all methods from the class. The class is a partial class and I only get the methods from the 1st *.cs file.

Any idea or workaround?

0 Answers
Related