Is it possible to get in .NET summary data somehow?
/// <summary>
/// I need to get it programatically
/// </summary>
private void MethodA()
{
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
EnvDTEnamespace to get the current code element, you can then access theCommentandDocCommentproperties.You need to add references: How to: Add References to Automation Namespaces is a good place to start.
Then you need to get access to the
EnvDTEobject: How to: Get References to the DTE and DTE2 Objects.From there it depends on where your code is located. Through
EnvDTEyou have to find the project item it’s declared in, browse to it, and then access the comment properties.You can get the current document through the
ActiveDocumentproperty on yourDTEobject, which will return aDocument. If theDocumentis part of a project, you can grab theProjectItem, and through there access theCodeElementscollection.From there it gets slightly complicated. A
CodeElementdoes not have a comment property. You can useCodeElement.Kindto see what specific kind of code element you’re looking at:CodeClass,CodeFunction, etc… After deciding on the correct type, and casting to it, you can finally access the comment text. For navigating through your code elements, remember that they can haveChildren(eg. Properties in a Class).