Documents::Count Property

 

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

Namespace:   EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

property int Count {
	int get();
}

Property Value

Type: System::Int32

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

public void Example(DTE2 dte)
{
   try
   {
      // Run this code after opening up a project with at least one document.
      Documents docs;

      // Return the documents collection in the current application instance.
      docs = dte.Documents;

      // Show the number of open documents in the current application.
      MessageBox.Show(docs.Count.ToString());

      // Show the parent object of the current docs collection.
      MessageBox.Show(docs.Parent.FullName);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}
Return to top
Show: