I have in hand an INamespaceBody, IClassDeclaration, and IMethod. I want to get the IMethodDeclaration corresponding to the IMethod and the IClassBody corresponding to the IClassDeclaration. But I am totally at a loss...how can I achieve this?
Asked
Active
Viewed 117 times
1 Answers
1
You can call the GetDeclarations() method on the given IMethod to get IMethodDeclaration
IMethod method = MyGetMethod(); // Your code to get the IMethod.
// This returns a list of IDeclaration
var declaration = main.GetDeclarations();
IMethodDeclaration methodDeclaration = declaration[0];
As for getting IClassBody from an IClassDeclaration, just call the Body
property.

user2999691
- 11
- 2