0

In Visual Studio, xml comments can be added to methods/classes to provide documentation. See http://msdn.microsoft.com/en-us/magazine/cc302121.aspx.

Visual Studio generates files from these xml comments and exports them, so they are accessible for sure.

My question is, is there a class of some sort that let's the program access the xml text at runtime? (I think the brute force way is to parse the exported files, but that's not a neat solution)

The reason I want to do this is because I'm making a kind of a helper program for a larger program, so I want to output the xml comments to screen. I have the property name through reflection, so is there a way to feed the name back in to some class and get the xml documentation?

I tried searching already, but I couldn't find anything. I might be wording it badly. Is this possible?

3 Answers 3

2

XML comments get stripped out of the executable - that's why there is a special compiler flag to generate the XML documentation from them, so they don't get lost.

There are tools that help you generate HTML help and other formats from these XML files.

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

Comments

1

As far as I now, the XML comments are not saved as metadata in the assembly binary file (.exe or .dll). So the only option is to directly parse the XML file generated by Visual Studio.

Comments

1

Try DocsByReflection.

// From type.
var typeDoc = DocsService.GetXmlFromType(typeof(Stub));

// From property.
var propertyInfo = typeof(Stub).GetProperty("PropertyWithDoc");
var propertyDoc = DocsService.GetXmlFromMember(propertyInfo);

// From method.
var methodInfo = typeof(Stub).GetMethod("MethodWithGenericParameter");
var methodDoc = DocsService.GetXmlFromMember(methodInfo);

// From assembly.
var assemblyDoc = DocsService.GetXmlFromAssembly(typeof(Stub).Assembly);

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.