مشاركة عبر


Projects.Item أسلوب

إرجاع مفهرسة عضو Projectsمجموعة.

مساحة الاسم:  EnvDTE
التجميع:  EnvDTE (في EnvDTE.dll)

بناء الجملة

'إقرار
Function Item ( _
    index As Object _
) As Project
Project Item(
    Object index
)
Project^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Project 
function Item(
    index : Object
) : Project

المعلمات

  • index
    النوع: System.Object
    مطلوبة.فهرس العنصر للعودة.

القيمة المُرجعة

النوع: EnvDTE.Project
كائن Project .

ملاحظات

القيمة التي تم تمريرها إلى indexهو عدد صحيح فهرس Projectكائن في المجموعة الخاصة به. الالقيمة indexبدلاً من ذلك يمكن أن تكون القيمة سلسلة مساوياً إلى اسم مشروع في المجموعة.

يطرح الأسلوب عنصر ArgumentExceptionاستثناء إذا تعذر العثور على المجموعة الكائن الذي يتوافق مع إلى القيمة الفهرس.

أمثلة

public void CodeExample(DTE2 dte)
{  
    try
    {   // Open a project before running this sample
        Projects prjs = dte.Solution.Projects;
        string msg = "There are " + prjs.Count.ToString() + " projects in this collection.";
        msg += "\nThe application containing this Projects collection: " + prjs.DTE.Name;
        msg += "\nThe parent object of the Projects collection: " + prjs.Parent.Name;
        msg += "\nThe GUID representing the Projects type: " + prjs.Kind;
        if (prjs.Properties != null)
        {
            msg += "\nProperties:";
            foreach (Property prop in prjs.Properties)
            {
                msg += "\n   " + prop.Name;
            }
        }
        MessageBox.Show(msg, "Projects Collection");
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

أمن NET Framework.

راجع أيضًَا

المرجع

Projects واجهة

Projects الأعضاء

EnvDTE مساحة الاسم

موارد أخرى

كيفية: الترجمة وإعادة تشغيل أمثلة التعليمات البرمجية لطراز كائن التنفيذ التلقائي