Created
April 3, 2011 22:59
-
-
Save yetanotherchris/900905 to your computer and use it in GitHub Desktop.
ndoc 3 fix
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
/// <summary> | |
/// Returns the original summary for a member inherited from a specified type. | |
/// </summary> | |
/// <param name="memberID">The member ID to lookup.</param> | |
/// <param name="declaringType">The type that declares that member.</param> | |
/// <returns>The summary xml. If not found, returns an zero length string.</returns> | |
public string GetSummary(string memberID, Type declaringType) { | |
//extract member type (T:, P:, etc.) | |
string memberType = memberID.Substring(0, 2); | |
//extract member name | |
int i = memberID.IndexOf('('); | |
string memberName = i > -1 ? memberID.Substring(memberID.LastIndexOf('.', i) + 1) | |
: memberID.Substring(memberID.LastIndexOf('.') + 1); | |
//the member id in the declaring assembly | |
string summary = ""; | |
if (declaringType != null && declaringType.FullName != null) | |
{ | |
string key = memberType + declaringType.FullName.Replace("+", ".") + "." + memberName; | |
//check the summaries cache first | |
summary = (string)summaries[key]; | |
if (summary == null) | |
{ | |
//lookup the xml document | |
GetXmlFor(declaringType); | |
//the summary should now be cached (if it exists!) | |
//so lets have another go at getting it... | |
summary = (string)summaries[key]; | |
//if no summary was not found, create an blank one | |
if (summary == null) | |
{ | |
//Debug.WriteLine("#NoSummary#\t" + key); | |
summary = ""; | |
//cache the blank so we don't search for it again | |
summaries.Add(key, summary); | |
} | |
} | |
} | |
return "<summary>" + summary + "</summary>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment