WqlEventQuery.GroupWithinInterval Proprietà

Definizione

Ottiene o imposta l'intervallo da utilizzare per raggruppare gli eventi dello stesso tipo.

public:
 property TimeSpan GroupWithinInterval { TimeSpan get(); void set(TimeSpan value); };
public TimeSpan GroupWithinInterval { get; set; }
member this.GroupWithinInterval : TimeSpan with get, set
Public Property GroupWithinInterval As TimeSpan

Valore della proprietà

Restituisce un TimeSpan valore contenente l'intervallo utilizzato per raggruppare gli eventi dello stesso tipo.

Esempio

Nell'esempio seguente viene inizializzato un nuovo WqlEventQuery oggetto e viene visualizzata la stringa di query dell'evento.

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

Commenti

L'impostazione di questo valore della proprietà esegue l'override di qualsiasi valore precedente archiviato nell'oggetto . La stringa di query viene ricompilata per riflettere il nuovo intervallo.

Valore della proprietà

Null, se non è coinvolto alcun raggruppamento; in caso contrario, l'intervallo in cui WMI deve raggruppare gli eventi dello stesso tipo.

Sicurezza di .NET Framework

Attendibilità totale per il chiamante immediato. Questo membro non può essere utilizzato da codice parzialmente attendibile. Per altre informazioni, vedere Uso di librerie da codice parzialmente attendibile.

Si applica a