共用方式為


SuppressMessageAttribute.CheckId 屬性

定義

取得要隱藏之程式代碼分析工具規則的標識碼。

public:
 property System::String ^ CheckId { System::String ^ get(); };
public string CheckId { get; }
member this.CheckId : string
Public ReadOnly Property CheckId As String

屬性值

要隱藏之程式代碼分析工具規則的標識碼。

範例

下列程式代碼範例示範如何使用 SuppressMessageAttribute 屬性來隱藏類別和 CA1801CA1804 檢查標識碼的警告Microsoft.Performance。 此程式代碼範例是提供給 類別之較大範例的 SuppressMessageAttribute 一部分。

[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "isChecked")]
[SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "fileIdentifier")]
static void FileNode(string name, bool isChecked)
{
    string fileIdentifier = name;
    string fileName = name;
    string version = String.Empty;
}
<SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId:="isChecked"), _
 SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId:="fileIdentifier")> _
Shared Sub FileNode(ByVal name As String, ByVal isChecked As Boolean)
    Dim fileIdentifier As String = name
    Dim fileName As String = name
    Dim version As String = String.Empty

End Sub

備註

串連在一起, CategoryCheckId 屬性形成唯一的檢查標識符。

適用於