private bool NeedsResolving(CommonComments comments) { return(comments?.Inheritdoc != null && string.IsNullOrEmpty(comments.Summary) && string.IsNullOrEmpty(comments.Remarks) && string.IsNullOrEmpty(comments.Example)); }
private void GetCommonComments(CommonComments comments, XPathNavigator rootNode) { comments.Summary = GetSummaryComment(rootNode); comments.Remarks = GetRemarksComment(rootNode); comments.Example = GetExampleComment(rootNode); comments.Inheritdoc = GetInheritdocTag(rootNode); }
/// <summary> /// Returns comments for specified class member. /// </summary> /// <param name="memberInfo"></param> /// <returns></returns> public CommonComments GetMemberComments(MemberInfo memberInfo) { var comments = new CommonComments(); var node = GetXmlMemberNode(memberInfo.MemberId(), memberInfo?.ReflectedType); return(GetComments(memberInfo, comments, node)); }
protected CommonComments GetComments(MemberInfo memberInfo, CommonComments comments, XPathNavigator node) { if (node == null) { return(comments); } GetCommonComments(comments, node); comments = ResolveInheritdocComments(comments, memberInfo); return(comments); }
private CommonComments ResolveInheritdocComments(CommonComments comments, MemberInfo memberInfo) { if (!NeedsResolving(comments)) { return(comments); } // If an explicit cref attribute is specified, the documentation from // the specified namespace/type/member is inherited. GetCrefComments(comments.Inheritdoc.Cref, memberInfo.DeclaringType, comments, (node) => GetComments(memberInfo, comments, node)); return(comments); }
private bool GetCrefComments(string cref, Type typeForAssembly, CommonComments comments, Action <XPathNavigator> getCommentAction) { if (string.IsNullOrEmpty(cref)) { return(false); } var typeNode = GetXmlMemberNode(cref, typeForAssembly, true); var inheritdoc = comments.Inheritdoc; comments.Inheritdoc = null; getCommentAction(typeNode); comments.Inheritdoc = inheritdoc; return(true); }