0

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?

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.