WqlEventQuery.GroupWithinInterval 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定用於分組同類型事件的區間。
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
屬性值
回傳 TimeSpan 一個包含用於分組同類型事件的區間的值。
範例
以下範例初始化一個新事件 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
備註
設定此屬性值會覆蓋物件中先前儲存的任何值。 查詢字串會被重建以反映新的區間。
屬性值
若不涉及分組,則為零;否則,WMI 應在相同類型事件分組的區間。
.NET Framework 安全性
完全信任當下的來電者。 此成員無法被部分受信任的程式碼使用。 欲了解更多資訊,請參閱 「部分受信任程式碼的函式庫使用」。