WqlEventQuery.GroupByPropertyList Property

Definition

Gets or sets properties in the event to be used for grouping events of the same type.

public System.Collections.Specialized.StringCollection GroupByPropertyList { get; set; }

Property Value

Returns a StringCollection containing the properties in the event to be used for grouping events of the same type.

Examples

The following example initializes a new WqlEventQuery and displays the event query string.

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;
    }
}

Remarks

Setting this property value overrides any previous value stored in the object. The query string is rebuilt to reflect the new grouping.

Property Value

Null, if no grouping is required; otherwise, a collection of event property names.

.NET Framework Security

Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.

Applies to

Prodotto Versioni
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)