Collection Property
The document is archived and information here might be outdated

Window.Collection Property

Gets the collection containing the Window object supporting this property.

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

Windows Collection { get; }
/** @property */
Windows get_Collection ()

function get Collection () : Windows

Property Value

A Windows collection.

public void CodeExample(DTE2 dte, AddIn addin)
    {   // Before running, create a text file named 
        // "TextFile1.txt", include it in your solution,
        // and make it the active window.
        Window win;
        Document doc;
        if (dte.Documents.Count > 0)
            doc = dte.Documents.Item("TextFile1.txt");
            win = doc.ActiveWindow;
            // Show the name of the project that contains this window and document.
            win.Activate(); // Activate the window
            // Show the name of the current ProjectItem in the window.
            // How many other windows are available?
            string w = "Windows:\n";
            foreach (Window wi in win.Collection)
                w = w + wi.Caption + "\n";
            // Determine that the document returned by the document 
            // property is the same as the document object 'doc'.
            if (win.Document.Equals(doc))
                MessageBox.Show("The documents match!");
            else MessageBox.Show("The documents do not match!");
            // Close the window.
    catch(Exception ex)
© 2016 Microsoft