ENع
الدرس 13 · Working with data

Generics

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

Generics let you write a class or method once and use it with any type, without losing type checks. Follow one generic class, Box<T>, as Program.cs uses it twice: the type arguments int and string replace the type parameter T, the compiler makes the constructed types Box<int> and Box<string>, catches wrong types before anything runs, and at run time the program prints 42 hi.

12 دقيقة11 خطوات5 أسئلةIntermediate
شكل 13 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.