DVELPR
DVELPR

Reputation: 304

How to Get comments in .net compiled files?

How can read or retrieve comments in .net compiled files for example

    'get current os info
   Public Property CheckOs As String 'checking operating system

we can read the property with ilspy or reflector but where we find the comments {" 'get current os info, 'checking operating system"} is that stored in resources or any other places ?.

Upvotes: 1

Views: 523

Answers (1)

dwilliss
dwilliss

Reputation: 924

In VB.NET, you can add comments above a function, property, or whatever starting with '''. Visual Studio will automatically provide a template XML comment block that looks like this:

''' <summary>
''' 
''' </summary>
''' <param name="emailAddress"></param>
''' <returns></returns>

I just copied and pasted that from a function that has one parameter called emailAddress - YMMV. If you fill this in (at least the summary part), then Visual Studio's Intellisense will give you a tool-tip with the function help whenever you hover over a call to that function start typing a call to it.

Also, the compiler will write out an XML file containing the XML comment data along with your DLL. If you keep that XML with the DLL when you reference it in another project, then the programmer using it will get the Intellisense too.

Note, this same feature exists for C#, but uses /// instead of '''

Upvotes: 1

Related Questions