Projects.Count Property
Gets a value indicating the number of objects in the Projects collection.
Namespace: EnvDTE
Assembly: EnvDTE (in EnvDTE.dll)
Syntax
'Declaration
ReadOnly Property Count As Integer
'Usage
Dim instance As Projects
Dim value As Integer
value = instance.Count
int Count { get; }
property int Count {
int get ();
}
function get Count () : int
Property Value
Type: System.Int32
An integer value indicating the number of objects in the Projects collection.
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);
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
Other Resources
How to: Compile and Run the Automation Object Model Code Examples