共用方式為


WqlEventQuery.GroupByPropertyList 屬性

定義

取得或設定要用於劃分相同型別事件群組的事件屬性。

public:
 property System::Collections::Specialized::StringCollection ^ GroupByPropertyList { System::Collections::Specialized::StringCollection ^ get(); void set(System::Collections::Specialized::StringCollection ^ value); };
public System.Collections.Specialized.StringCollection GroupByPropertyList { get; set; }
member this.GroupByPropertyList : System.Collections.Specialized.StringCollection with get, set
Public Property GroupByPropertyList As StringCollection

屬性值

傳回 StringCollection,內含要用來劃分相同型別之事件群組的事件屬性。

範例

下列範例會初始化新的 WqlEventQuery ,並顯示事件查詢字串。

using System;
using System.Management;

public class EventSample
{
    public static void Main(string[] args)
    {
        WqlEventQuery query = new WqlEventQuery();
        query.EventClassName = "__InstanceCreationEvent";
        query.Condition = "TargetInstance ISA 'Win32_NTLogEvent'";
        query.GroupWithinInterval = new TimeSpan(0, 0, 10);
        System.Collections.Specialized.StringCollection collection =
            new System.Collections.Specialized.StringCollection();
        collection.Add("TargetInstance.SourceName");
        query.GroupByPropertyList = collection;
        query.HavingCondition = "NumberOfEvents > 25";

        Console.WriteLine(query.QueryString);
        return;
    }
}
Imports System.Management


Public Class EventSample
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer

        Dim query As New WqlEventQuery
        query.EventClassName = "__InstanceCreationEvent"
        query.Condition = "TargetInstance ISA 'Win32_NTLogEvent'"
        query.GroupWithinInterval = New TimeSpan(0, 0, 10)
        Dim collection As New System.Collections.Specialized. _
            StringCollection
        collection.Add("TargetInstance.SourceName")
        query.GroupByPropertyList = collection
        query.HavingCondition = "NumberOfEvents > 25"

        MessageBox.Show(query.QueryString)

    End Function 'Main
End Class

備註

設定這個屬性值會覆寫儲存在 物件中的任何先前值。 系統會重建查詢字串以反映新的群組。

屬性值

Null,如果不需要任何群組則為 ;否則,事件屬性名稱的集合。

.NET Framework 安全性

完全信任立即呼叫者。 這個成員無法供部分信任的程式碼使用。 如需詳細資訊,請參閱 使用部分信任程式代碼的連結庫

適用於