حدث
إنشاء تطبيقات ووكلاء الذكاء الاصطناعي
١٧ رمضان، ٩ م - ٢١ رمضان، ١٠ ص
انضم إلى سلسلة الاجتماعات لإنشاء حلول الذكاء الاصطناعي قابلة للتطوير استنادا إلى حالات الاستخدام في العالم الحقيقي مع المطورين والخبراء الآخرين.
تسجيل الآنلم يعد هذا المتصفح مدعومًا.
بادر بالترقية إلى Microsoft Edge للاستفادة من أحدث الميزات والتحديثات الأمنية والدعم الفني.
The following table shows the default values of C# types:
Type | Default value |
---|---|
Any reference type | null |
Any built-in integral numeric type | 0 (zero) |
Any built-in floating-point numeric type | 0 (zero) |
bool | false |
char | '\0' (U+0000) |
enum | The value produced by the expression (E)0 , where E is the enum identifier. |
struct | The value produced by setting all value-type fields to their default values and all reference-type fields to null . |
Any nullable value type | An instance for which the HasValue property is false and the Value property is undefined. That default value is also known as the null value of a nullable value type. |
Use the default
operator to produce the default value of a type, as the following example shows:
int a = default(int);
You can use the default
literal to initialize a variable with the default value of its type:
int a = default;
For a value type, the implicit parameterless constructor also produces the default value of the type, as the following example shows:
var n = new System.Numerics.Complex();
Console.WriteLine(n); // output: (0, 0)
At run time, if the System.Type instance represents a value type, you can use the Activator.CreateInstance(Type) method to invoke the parameterless constructor to obtain the default value of the type.
ملاحظة
A structure type (which is a value type) may have an explicit parameterless constructor that may produce a non-default value of the type. Thus, we recommend using the default
operator or the default
literal to produce the default value of a type.
For more information, see the following sections of the C# language specification:
ملاحظات .NET
.NET هو مشروع مصدر مفتوح. حدد رابطًا لتقديم الملاحظات:
حدث
إنشاء تطبيقات ووكلاء الذكاء الاصطناعي
١٧ رمضان، ٩ م - ٢١ رمضان، ١٠ ص
انضم إلى سلسلة الاجتماعات لإنشاء حلول الذكاء الاصطناعي قابلة للتطوير استنادا إلى حالات الاستخدام في العالم الحقيقي مع المطورين والخبراء الآخرين.
تسجيل الآن