ElapsedEventArgsとは? わかりやすく解説

ElapsedEventArgs クラス

Timer.Elapsed イベントデータ提供します

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

Public Class ElapsedEventArgs
    Inherits EventArgs
Dim instance As ElapsedEventArgs
public class ElapsedEventArgs : EventArgs
public ref class ElapsedEventArgs : public
 EventArgs
public class ElapsedEventArgs extends EventArgs
public class ElapsedEventArgs extends
 EventArgs
使用例使用例
Imports System
Imports System.Timers

Public Class Timer1
    
    Public Shared Sub Main()
        ' Normally, the timer is declared at the class level, so
        ' that it doesn't go out of scope when the method ends.
        ' In this example, the timer is needed only while Main 
        ' is executing. However, KeepAlive must be used at the
        ' end of Main, to prevent the JIT compiler from allowing 
        ' aggressive garbage collection to occur before Main 
        ' ends.
        Dim aTimer As New
 System.Timers.Timer()

        ' Hook up the Elapsed event for the timer.
        AddHandler aTimer.Elapsed, AddressOf
 OnTimedEvent

        ' Set the Interval to 2 seconds (2000 milliseconds).
        aTimer.Interval = 2000
        aTimer.Enabled = True
        
        Console.WriteLine("Press the Enter key to exit the program.")
        Console.ReadLine()

        ' Keep the timer alive until the end of Main.
        GC.KeepAlive(aTimer)
    End Sub
        
    ' Specify what you want to happen when the Elapsed event is 
    ' raised.
    Private Shared Sub OnTimedEvent(source
 As Object, e As ElapsedEventArgs)
        Console.WriteLine("Hello World!")
    End Sub
End Class

using System;
using System.Timers;

public class Timer1
{
    public static void Main()
    {
        // Normally, the timer is declared at the class level, so
        // that it doesn't go out of scope when the method ends.
        // In this example, the timer is needed only while Main 
        // is executing. However, KeepAlive must be used at the
        // end of Main, to prevent the JIT compiler from allowing 
        // aggressive garbage collection to occur before Main 
        // ends.
        System.Timers.Timer aTimer = new System.Timers.Timer();

        // Hook up the Elapsed event for the timer.
        aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

        // Set the Interval to 2 seconds (2000 milliseconds).
        aTimer.Interval = 2000;
        aTimer.Enabled = true;
 
        Console.WriteLine("Press the Enter key to exit the program.");
        Console.ReadLine();

        // Keep the timer alive until the end of Main.
        GC.KeepAlive(aTimer);
    }
 
    // Specify what you want to happen when the Elapsed event is 
    // raised.
    private static void
 OnTimedEvent(object source, ElapsedEventArgs e)
    {
        Console.WriteLine("Hello World!");
    }
}
 
#using <system.dll>

using namespace System;
using namespace System::Timers;

public ref class Timer1
{
public:
   static void Demo()
   {
      // Normally, the timer is declared at the class level, so
      // that it doesn't go out of scope when the method ends.
      // In this example, the timer is needed only while Demo
      // is executing. However, KeepAlive must be used at the
      // end of Demo, to prevent the JIT compiler from allowing 
      // aggressive garbage collection to occur before Demo
      // ends.
      System::Timers::Timer^ aTimer = gcnew System::Timers::Timer;

      // Hook up the Elapsed event for the timer.
      aTimer->Elapsed += gcnew ElapsedEventHandler( Timer1::OnTimedEvent );
      
      // Set the Interval to 2 seconds (2000 milliseconds).
      aTimer->Interval = 2000;
      aTimer->Enabled = true;

      Console::WriteLine("Press the Enter key to exit the program.");
      Console::ReadLine();

      // Keep the timer alive until the end of the Demo method.
      GC::KeepAlive(aTimer);
   }


private:
   // Specify what you want to happen when the Elapsed event is 
   // raised.
   static void OnTimedEvent( Object^ /*source*/,
 ElapsedEventArgs^ /*e*/ )
   {
      Console::WriteLine( "Hello World!" );
   }

};

int main()
{
   Timer1::Demo();
}

継承階層継承階層
System.Object
   System.EventArgs
    System.Timers.ElapsedEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ElapsedEventArgs メンバ
System.Timers 名前空間

ElapsedEventArgs プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ SignalTime Timer.Elapsed イベント発生した時刻取得します
参照参照

関連項目

ElapsedEventArgs クラス
System.Timers 名前空間

ElapsedEventArgs メソッド


ElapsedEventArgs メンバ

Timer.Elapsed イベントデータ提供します

ElapsedEventArgs データ型公開されるメンバを以下の表に示します


パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ SignalTime Timer.Elapsed イベント発生した時刻取得します
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ElapsedEventArgs クラス
System.Timers 名前空間


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

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

辞書ショートカット

すべての辞書の索引

「ElapsedEventArgs」の関連用語

ElapsedEventArgsのお隣キーワード
検索ランキング

   

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



ElapsedEventArgsのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS