共用方式為


SuppressMessageAttribute.Category 屬性

定義

取得分類,識別屬性的分類。

public:
 property System::String ^ Category { System::String ^ get(); };
public string Category { get; }
member this.Category : string
Public ReadOnly Property Category 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

備註

屬性 Category 描述套用訊息歸併屬性的工具或工具分析類別。

適用於