EventLogEntryCollection.CopyTo メソッド
アセンブリ: System (system.dll 内)

Dim instance As EventLogEntryCollection Dim entries As EventLogEntry() Dim index As Integer instance.CopyTo(entries, index)

新しいエントリは既存のリストの末尾に追加されるため、コレクションを順に処理していけば、最初に EventLogEntryCollection を作成した後で作成されたエントリにもアクセスできます。EventLogEntry インスタンスの配列はインスタンス化された時点で固定されるため、CopyTo メソッドで返された配列を使用して新しいエントリを読み取ることはできません。

' Copy the EventLog entries to Array of type EventLogEntry. Dim myEventLogEntryArray(myEventLogEntryCollection.Count-1) As EventLogEntry myEventLogEntryCollection.CopyTo(myEventLogEntryArray, 0) Dim myEnumerator As IEnumerator = myEventLogEntryArray.GetEnumerator() While myEnumerator.MoveNext() Dim myEventLogEntry As EventLogEntry = CType(myEnumerator.Current, EventLogEntry) Console.WriteLine("The LocalTime the Event is generated is " + _ myEventLogEntry.TimeGenerated) End While
// Copy the EventLog entries to Array of type EventLogEntry. EventLogEntry[] myEventLogEntryArray= new EventLogEntry[myEventLogEntryCollection.Count]; myEventLogEntryCollection.CopyTo(myEventLogEntryArray,0); IEnumerator myEnumerator=myEventLogEntryArray.GetEnumerator(); while(myEnumerator.MoveNext()) { EventLogEntry myEventLogEntry =(EventLogEntry)myEnumerator.Current; Console.WriteLine("The LocalTime the Event is generated is " +myEventLogEntry.TimeGenerated); }
// Copy the EventLog entries to Array of type EventLogEntry. EventLogEntry myEventLogEntryArray[] = new EventLogEntry[myEventLogEntryCollection.get_Count()]; myEventLogEntryCollection.CopyTo(myEventLogEntryArray, 0); IEnumerator myEnumerator = myEventLogEntryArray.GetEnumerator(); while (myEnumerator.MoveNext()) { EventLogEntry myEventLogEntry = (EventLogEntry)myEnumerator.get_Current(); Console.WriteLine("The LocalTime the Event is generated is " + myEventLogEntry.get_TimeGenerated()); }

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からEventLogEntryCollection.CopyTo メソッドを検索する場合は、下記のリンクをクリックしてください。

- EventLogEntryCollection.CopyTo メソッドのページへのリンク