0

私は 1 年前に 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これは少し鈍いです(複数のインターフェースの場合)

ここにインターフェイス名を挿入する例はありますか?

4

1 に答える 1