Share via


Projects.Count Property

Definition

Gets a value indicating the number of objects in the Projects collection.

public:
 property int Count { int get(); };
public:
 property int Count { int get(); };
[System.Runtime.InteropServices.DispId(10)]
public int Count { [System.Runtime.InteropServices.DispId(10)] get; }
[<System.Runtime.InteropServices.DispId(10)>]
[<get: System.Runtime.InteropServices.DispId(10)>]
member this.Count : int
Public ReadOnly Property Count As Integer

Property Value

An integer value indicating the number of objects in the Projects collection.

Attributes

Examples

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);  
    }  
}  

Applies to