EventLogEntryCollection.CopyTo メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > EventLogEntryCollection.CopyTo メソッドの意味・解説 

EventLogEntryCollection.CopyTo メソッド

EventLogEntryCollection の要素を、EventLogEntry インスタンス配列コピーします (インスタンス配列特定の配列インデックスからコピー開始されます)。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

Public Sub CopyTo ( _
    entries As EventLogEntry(), _
    index As Integer _
)
Dim instance As EventLogEntryCollection
Dim entries As EventLogEntry()
Dim index As Integer

instance.CopyTo(entries, index)
public void CopyTo (
    EventLogEntry[] entries,
    int index
)
public:
void CopyTo (
    array<EventLogEntry^>^ entries, 
    int index
)
public void CopyTo (
    EventLogEntry[] entries, 
    int index
)
public function CopyTo (
    entries : EventLogEntry[], 
    index : int
)

パラメータ

entries

コレクションからコピーされる要素コピー先である EventLogEntry インスタンス1 次元配列配列では 0 から始まるインデックス使用する必要があります

index

コピー開始する配列内の、0 から始まるインデックス

解説解説

新しいエントリは既存リスト末尾追加されるため、コレクションを順に処理していけば、最初に 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());
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
EventLogEntryCollection クラス
EventLogEntryCollection メンバ
System.Diagnostics 名前空間
EventLog.Entries プロパティ


このページでは「.NET Framework クラス ライブラリ リファレンス」からEventLogEntryCollection.CopyTo メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からEventLogEntryCollection.CopyTo メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からEventLogEntryCollection.CopyTo メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

EventLogEntryCollection.CopyTo メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



EventLogEntryCollection.CopyTo メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS