簡體   English   中英

如何獲取GhostDoc來正確記錄接口實現?

[英]How can I get GhostDoc to properly document interface implementation?

一年前,我在Visual Studio 2015中使用了Ghostdoc Free,非常喜歡它的功能,因此決定購買它。 現在,我必須使用Visual Studio 2012,並且注意到對類的注釋不如以前。

現在它只是說:

/// The ClassName class.

而在此之前,它將區分實現以下接口的類:

/// Implements the <see cref="IInterfaceName"

我查看了規則,但不確定如何提取接口名稱。 我現在有這個:

/// Generates the summary documentation of the class.
private void GenerateSummaryDocumentation()
{
    // Assign the current code element.
    var codeElement = Context.CurrentCodeElement;

    // If the class appears to be a base class.
    if (codeElement.Name.EndsWith("Base"))
    {
        // Write the summary documentation of the class.
        this.WriteLine("Provides a base class to derive {0} of.", Context.ExecMacro("$(TypeName.Words.All)"));
    }
    else
    {
        if (codeElement.HasBaseTypes)
        {
            var baseType = codeElement.BaseTypes[0];
            baseType = baseType.Substring(baseType.LastIndexOf(".") + 1);
            this.WriteLine("Implementation of {0}", baseType);
        }
        else
        {
            // Write the summary documentation of the class.
            this.WriteLine("Provides a class that implements a {0}", Context.ExecMacro("$(TypeName.Words.All)"));               
        }
    }

    return;
}

結果是:

/// Provides a class that implements a class name只是采用該類名並將其拆分。 /// Implementation of IInterfaceName有點鈍(在多個接口的情況下)

有沒有可以在此處插入接口名稱的示例?

規則模板中的codeElement.BaseTypes [0]應該已返回生成注釋的接口名稱。

我們很樂意幫助您解決此問題,請通過submain dot com的支持小組給我們發送電子郵件

謝謝!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM