473,320 Members | 1,821 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

XML Comments and Reflection

Does anyone know how to programmatically retrieve a method's XML comments
through reflection or any other run-time means?

I actually always thought that the description you put in comments was
automatically put into the DescriptionAttribute, but after testing this
doesn't seem to be the case...

--
John Wood
EMail: first name, dot, second name at priorganize.com

Nov 16 '05 #1
10 7449
Hi John,

You are right John; the comments are not put into the DescriptionAttribute.

Have a look at the NDoc source code on how to extract the XML documentation:
http://sourceforge.net/projects/ndoc/

HTH,
Rakesh Rajan

"John Wood" <sp**@isannoying.com> wrote in message
news:eg*************@tk2msftngp13.phx.gbl...
Does anyone know how to programmatically retrieve a method's XML comments
through reflection or any other run-time means?

I actually always thought that the description you put in comments was
automatically put into the DescriptionAttribute, but after testing this
doesn't seem to be the case...

--
John Wood
EMail: first name, dot, second name at priorganize.com

Nov 16 '05 #2
Hi Rakesh,
Thanks for your reply.
nDoc seems to process the XML that's exported from a Visual Studio
project... so no luck there.

It seems elusive... how do you extract the summary comments from an
assembly?!

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Rakesh Rajan" <ra**********************@hotmail.com> wrote in message
news:Ox**************@TK2MSFTNGP15.phx.gbl...
Hi John,

You are right John; the comments are not put into the DescriptionAttribute.
Have a look at the NDoc source code on how to extract the XML documentation: http://sourceforge.net/projects/ndoc/

HTH,
Rakesh Rajan

"John Wood" <sp**@isannoying.com> wrote in message
news:eg*************@tk2msftngp13.phx.gbl...
Does anyone know how to programmatically retrieve a method's XML comments through reflection or any other run-time means?

I actually always thought that the description you put in comments was
automatically put into the DescriptionAttribute, but after testing this
doesn't seem to be the case...

--
John Wood
EMail: first name, dot, second name at priorganize.com


Nov 16 '05 #3
John Wood <sp**@isannoying.com> wrote:
Thanks for your reply.
nDoc seems to process the XML that's exported from a Visual Studio
project... so no luck there.

It seems elusive... how do you extract the summary comments from an
assembly?!


They're not *in* the assembly - they're only in the .xml file.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #4
I'm beginning to think you're right.
Why did they do it that way? Wouldn't it have made more sense to have
included the descriptions as attributes as part of the metadata? Even in COM
they did it this way, putting the information into the type library... seems
pretty stupid to have it separate to the DLL like that.

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
John Wood <sp**@isannoying.com> wrote:
Thanks for your reply.
nDoc seems to process the XML that's exported from a Visual Studio
project... so no luck there.

It seems elusive... how do you extract the summary comments from an
assembly?!


They're not *in* the assembly - they're only in the .xml file.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 16 '05 #5
John Wood <jo*******@priorganize.com> wrote:
I'm beginning to think you're right.
Why did they do it that way? Wouldn't it have made more sense to have
included the descriptions as attributes as part of the metadata? Even in COM
they did it this way, putting the information into the type library...
What information, exactly? Documentation? That doesn't sound right to
me, although I admit I'm not a COM expert by any means.
seems pretty stupid to have it separate to the DLL like that.


Let me be clear - attributes *are* in the assembly. It's only the XML
documentation which isn't. That makes sense, because it's really for
human use. While it makes sense to ship it with an SDK, it makes sense
*not* to ship it with an end-user product. Well-written documentation
can easily end up being as large as the assembly itself. For non-
developers, it's completely useless - so why include it?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #6
Hi John:

I guess you are referring to the helpstring attribute which shipped as
part of the type libary:

__interface IBar : IDispatch
{
[id(1), helpstring("This method does Foo")]
HRESULT Foo([in] BSTR param1);
}

I personally never found these brief descriptions very informative,
but I can imagine some people might have put some work into them to
make them useful.

You could do something similar with CustomAttributes, or perhaps write
a macro or plugin to add XML comments into a DescriptionAttribute, but
I don't know of any existing tools that would utilize this information
from an assembly (unless you are building COM visible types...)

--
Scott
http://www.OdeToCode.com/

On Tue, 5 Oct 2004 09:35:01 -0400, "John Wood"
<jo*******@priorganize.com> wrote:
I'm beginning to think you're right.
Why did they do it that way? Wouldn't it have made more sense to have
included the descriptions as attributes as part of the metadata? Even in COM
they did it this way, putting the information into the type library... seems
pretty stupid to have it separate to the DLL like that.


Nov 16 '05 #7
> I guess you are referring to the helpstring attribute which shipped as
part of the type libary:
Right. The type library is an optional resource in a module, and the
helpstring is useful for things like intellisense and the object browser. I
can't imagine anyone would say that intellisense descriptions aren't useful?

The good thing about type libraries is that they can be removed from the
component modules before they are released, as they're just resources (in
the case of most apps anyway).

--
John Wood
EMail: first name, dot, second name at priorganize.com
"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:bu********************************@4ax.com... Hi John:

I guess you are referring to the helpstring attribute which shipped as
part of the type libary:

__interface IBar : IDispatch
{
[id(1), helpstring("This method does Foo")]
HRESULT Foo([in] BSTR param1);
}

I personally never found these brief descriptions very informative,
but I can imagine some people might have put some work into them to
make them useful.

You could do something similar with CustomAttributes, or perhaps write
a macro or plugin to add XML comments into a DescriptionAttribute, but
I don't know of any existing tools that would utilize this information
from an assembly (unless you are building COM visible types...)

--
Scott
http://www.OdeToCode.com/

On Tue, 5 Oct 2004 09:35:01 -0400, "John Wood"
<jo*******@priorganize.com> wrote:
I'm beginning to think you're right.
Why did they do it that way? Wouldn't it have made more sense to have
included the descriptions as attributes as part of the metadata? Even in COMthey did it this way, putting the information into the type library... seemspretty stupid to have it separate to the DLL like that.

Nov 16 '05 #8
>> although I admit I'm not a COM expert by any means. <<

So what were you doing before .net came along?
Assuming you're older than, say, 5 ;)

--
John Wood
EMail: first name, dot, second name at priorganize.com
Nov 16 '05 #9
John Wood <sp**@isannoying.com> wrote:
although I admit I'm not a COM expert by any means. <<


So what were you doing before .net came along?
Assuming you're older than, say, 5 ;)


Java.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #10
John Wood <sp**@isannoying.com> wrote:
I guess you are referring to the helpstring attribute which shipped as
part of the type libary:
Right. The type library is an optional resource in a module, and the
helpstring is useful for things like intellisense and the object browser.


If you want to use intellisense and the object browser, just supply the
XML file.
I can't imagine anyone would say that intellisense descriptions aren't
useful?
They're useful to developers, so you supply the XML file to developers,
but not to end users.
The good thing about type libraries is that they can be removed from the
component modules before they are released, as they're just resources (in
the case of most apps anyway).


I think I'd rather have the files separate to start with, myself, so
that the assembly the developer uses is *exactly* the same assembly
that the user uses.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: A. Wiebenga | last post by:
Hi all! I am a student at the Hogeschool van Arnhem en Nijmegen in Holland. I am currently involved in a research project regarding Reflection. Purpose of the research project is to document...
11
by: Guotao Luan | last post by:
Hello All: I notice that there have been frequent questions being asked about template here so I guess it is okay to post this message here. I just wrote a c++ tempalte tutorial/review, I would...
1
by: Tomk | last post by:
I'm using VB.DOC & NDoc for now until Whidbey is released and I'm looking for a way to extract and compile my XML comments for private methods. These tools and I beleive the existing C# doc...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
1
by: Tristan | last post by:
Hi, When summary comments are placed above methods in an interface, is it possible that these comments also correspond to the derived classes i.e. public myInterface { ///<summary> /// An...
3
by: A.M-SG | last post by:
Hi, I have all my code commented with /// type of comments. What are my options to generate MSDN like documentation for my code and also possibly create a help file for my code?
0
by: Shawn Hogan | last post by:
Hi everyone, I've been trying to execute a control's private event code via reflection from another class with the goal of potentially doing some unit testing. The examples below are trying to...
9
by: Kuberan Naganathan | last post by:
Hello all Does anyone know of a good way to use reflection in c++? I don't mean simply using rtti or dynamic casting. I'm talking about java/c# style reflection where an actual instance of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.