Created
February 8, 2011 14:18
-
-
Save mindplay-dk/816498 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extension for System.Type enabling direct access to <summary> contents. | |
// | |
// This extension uses DocsByReflection by Jim Blackler: | |
// | |
// http://jimblackler.net/blog/?p=49 | |
// | |
// (this just does the summary for types, but it should be easy to extend this | |
// concept to include other members and other tags...) | |
static class DocsByReflectionExtensions | |
{ | |
/// <summary> | |
/// Gets the summary from the <summary> tag in documentation comments of the given Type. | |
/// </summary> | |
public static string GetSummary(this System.Type type) | |
{ | |
XmlElement xml = DocsByReflection.XMLFromType(type); | |
var summary = xml["summary"]; | |
return summary != null ? summary.InnerText.Trim() : type.Name; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment