Partilhar via


Documents.Count Property

Definition

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

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

Property Value

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

Attributes

Examples

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

Applies to