Freigeben über


Solution4.Count Property

Definition

Gets a value indicating the number of projects in the solution.

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

Property Value

The number of projects in the solution.

Implements

Attributes

Examples

Sub SolutionCountExample(ByVal dte As DTE2)  
    ' Count the projects in a solution.  
    ' Open a solution in Visual Studio before running this  
    ' example.  
   Try  
       Dim soln As Solution4 = CType(_applicationObject.Solution, _  
       Solution4)  
        ' List the number of projects.  
        MsgBox("Number of projects in" & soln.FullName & " is: " _  
        & vbCr & soln.Count)  
    Catch ex As System.Exception  
        MsgBox(ex.ToString)  
    End Try  
End Sub  
using System.Windows.Forms;  
public void SolutionCount(DTE2 dte)  
{  
    // Count the projects in a solution.  
    // Open a soultion in Visual Studio before running this  
    // example.  
    Try  
    {  
        Solution4 soln = (Solution4)_applicationObject.Solution;  
        // List the number of projects.  
        MessageBox.Show("Number of projects in" + soln.FullName   
          + " is: " + "\n" + soln.Count);  
    }  
    catch(SystemException ex)  
    {  
        MessageBox.Show("ERROR: " + ex);  
    }  
}  

Applies to