Views: 10.4K
Replies: 2
Archived
|
How to get a Class property description using Reflection?For example, below is a class property.
I want to get the description words in a summary. How do I do this? /// <summary> /// Passenger Type, the length is limited to 3 chars /// </summary> public string PassengerType { set { passengertype = value; } get { return passengertype; } } Thanks! Zhang Zhao, Nov 19, 2010
|
|
Reply 1If you want to use reflection to retieve the description of a class, you can use DescriptionAttribute to decorate your class/property
something like, [Description("Passenger Type, the length is limited to 3 chars")] public string PassengerType { set { passengertype = value; } get { return passengertype; } } Jun Ren, Dec 22, 2010
|
|
Reply 2Hi,
AFAIK there is no way, using reflection, to get hold of the Xml summary comments. That kind of information is not stored at all. What tools like NDoc and similar do, is that they let Visual Studio generate the comments in a separate xml file and the parse that file to extract the comments. HTH, Robert Robert Blixt, Nov 21, 2010
|