views:

40

answers:

3

Hi all.

let's say I have class A and class B. Class A's definition is:

/// <summary>
/// This is the class documentation.
/// </summary>
public class A
{
    /// <summary>
    /// This is the documentation for attribute.
    /// </summary>
    public int attribute;
    ...
}

I want to access the documentation from class A (ie. those strings that read 'This is the class documentation.' and 'This is the documentation for attribute.') in class B programatically. Is there a way to do this? using reflection, perhaps?

Thanks for your help :)

A: 

Generate the XML documentation file and then you can parse it programmatically.

dcp
A: 

The documentation is not exported into the program assemblies. It is (optionally) extracted into separate XML files.

To do as you suggest, you would need to find or write a tool that parses the XML files and adds metadata into the assembly, or ship the XML file with the assembly and dip into it when you wish to retrieve the related documentation.

Jason Williams
+2  A: 

I am assuming your using visual studio. Go to your project settings, set the Xml Documentation file path. When you compile , the comments will be dumped into an Xml file. You can then open the file programatically and read the comments

Andrew Keith
McKay