المقارنة بين خصائص مفهرسات (البرمجة C# إرشادات)
Indexers are مثل خصائص. Except for the differences shown في the following جدول, الجميع the rules that are defined for خاصية accessors يطبق على مفهرس accessors also.
الخصائص |
مفهرس |
---|---|
Allows وظائف إلى be called كـ if they were public بيانات الأعضاء. |
Allows عناصر of an internal مجموعة of an كائن إلى be accessed بواسطة using صفيفة notation تشغيل the كائن itself. |
Accessed through a simple اسم. |
Accessed through an فهرس. |
Can be a ثابت أو an مثيل عضو. |
Must be an مثيل عضو. |
A يحصل accessor of a خاصية has لا معلمات. |
A get accessor of an مفهرس has the same formal معلمة قائمة كـ the مفهرس. |
A التعيين accessor of a خاصية يحتوي على the implicit value معلمة. |
A set accessor of an مفهرس has the same formal معلمة قائمة كـ the مفهرس, و also إلى the القيمة معلمة. |
Supports shortened بناء الجملة مع الخصائص تلقائية التنفيذ (دليل البرمجة لـ #C). |
Does not دعم shortened بناء الجملة. |
راجع أيضًا:
المرجع
المفهرسات ( ارشادات برمجة C# )