حدث
١٧ رمضان، ٩ م - ٢١ رمضان، ١٠ ص
انضم إلى سلسلة الاجتماعات لإنشاء حلول الذكاء الاصطناعي قابلة للتطوير استنادا إلى حالات الاستخدام في العالم الحقيقي مع المطورين والخبراء الآخرين.
تسجيل الآنلم يعد هذا المتصفح مدعومًا.
بادر بالترقية إلى Microsoft Edge للاستفادة من أحدث الميزات والتحديثات الأمنية والدعم الفني.
.NET provides a hierarchy of exception classes ultimately derived from the Exception base class. However, if none of the predefined exceptions meet your needs, you can create your own exception class by deriving from the Exception class.
When creating your own exceptions, end the class name of the user-defined exception with the word "Exception", and implement the three common constructors, as shown in the following example. The example defines a new exception class named EmployeeListNotFoundException
. The class is derived from the Exception base class and includes three constructors.
using namespace System;
public ref class EmployeeListNotFoundException : Exception
{
public:
EmployeeListNotFoundException()
{
}
EmployeeListNotFoundException(String^ message)
: Exception(message)
{
}
EmployeeListNotFoundException(String^ message, Exception^ inner)
: Exception(message, inner)
{
}
};
using System;
public class EmployeeListNotFoundException : Exception
{
public EmployeeListNotFoundException()
{
}
public EmployeeListNotFoundException(string message)
: base(message)
{
}
public EmployeeListNotFoundException(string message, Exception inner)
: base(message, inner)
{
}
}
Public Class EmployeeListNotFoundException
Inherits Exception
Public Sub New()
End Sub
Public Sub New(message As String)
MyBase.New(message)
End Sub
Public Sub New(message As String, inner As Exception)
MyBase.New(message, inner)
End Sub
End Class
ملاحظة
In situations where you're using remoting, you must ensure that the metadata for any user-defined exceptions is available at the server (callee) and to the client (the proxy object or caller). For more information, see Best practices for exceptions.
ملاحظات .NET
.NET هو مشروع مصدر مفتوح. حدد رابطًا لتقديم الملاحظات:
حدث
١٧ رمضان، ٩ م - ٢١ رمضان، ١٠ ص
انضم إلى سلسلة الاجتماعات لإنشاء حلول الذكاء الاصطناعي قابلة للتطوير استنادا إلى حالات الاستخدام في العالم الحقيقي مع المطورين والخبراء الآخرين.
تسجيل الآنالتدريب
الوحدة النمطية
إنشاء استثناءات وطرحها في تطبيقات وحدة تحكم C# - Training
تستكشف هذه الوحدة النمطية عملية إنشاء الاستثناءات المخصصة وطرحها واصطيادها في تطبيق وحدة تحكم C#. توفر الأنشطة العملية تجربة تخصيص خصائص الاستثناء وطرح الاستثناءات واستخدام خصائص الاستثناء للتخفيف من الاستثناء داخل كتلة التقاط.