İngilizce dilinde oku

Aracılığıyla paylaş


ErrorEventArgs(Exception) Oluşturucu

Tanım

ErrorEventArgs sınıfının yeni bir örneğini başlatır.

C#
public ErrorEventArgs (Exception exception);

Parametreler

exception
Exception

Exception Oluşan hatayı temsil eden bir.

Örnekler

Aşağıdaki örnek yeni bir örneği ErrorEventArgs oluşturur ve ile Exceptionbaşlatır. Ardından örnek çağrısı GetException yapıp Exception hata iletisini görüntüler. Bu kodla ilişkilendirilmiş bir form yok.

C#

public static void Main(string[] args) {
   //Creates an exception with an error message.
   Exception myException= new Exception("This is an exception test");

   //Creates an ErrorEventArgs with the exception.
   ErrorEventArgs myErrorEventArgs = new ErrorEventArgs(myException);

   //Extracts the exception from the ErrorEventArgs and display it.
   Exception myReturnedException = myErrorEventArgs.GetException();
   MessageBox.Show("The returned exception is: " + myReturnedException.Message);
}

Şunlara uygulanır

Ürün Sürümler
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1