C# – Getting A Method Description Using Reflection

cnetreflection

Is it possible to get the comment description of a method or property using reflection. E.g When you use intellisense in Visual Studio to scroll through methods available to object there is a label which describes what the method does. How can I access this data programmatically using reflection?
your thoughts are much appreciated.
Tony

Best Answer

No. The method description is defined in an XML file (with the same name as the declaring assembly) extracted from XML comments in the source code. Visual Studio uses that XML file to load those stuff. The information is nowhere in the assembly metadata and naturally, it's not available using reflection:

/// <summary> Method description </summary>
public void Something() { ... }

When the C# compiler is invoked with /doc switch, it extracts the XML tags and puts it in the XML file. Visual Studio checks if an XML file is available along the referenced assembly and displays the description as appropriate.