Export (0) Print
Expand All

Project.Saved Property

Gets or sets a value indicating whether the object has not been modified since last being saved or opened.

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

bool Saved { get; set; }
/** @property */
boolean get_Saved ()

/** @property */
void set_Saved (/** @attribute InAttribute() */ boolean lpfReturn)

function get Saved () : boolean

function set Saved (lpfReturn : boolean)

Property Value

A Boolean value indicating true (default) if the object has not been modified since last being saved or opened; false if otherwise.

The Saved property replaces the IsDirty property in Visual Studio version 6.0, but it returns the opposite value of IsDirty.

public void CodeExample(DTE2 dte)
{  
    try
    {   // Open a project before running this sample.
        Project prj = dte.Solution.Projects.Item(1);
        Projects prjs;
        string msg, msg2 = "Global Variables:";
        msg = "FileName: " + prj.FileName;
        msg += "\nFullName: " + prj.FullName;
        msg += "\nProject-level access to " + prj.CodeModel.CodeElements.Count.ToString() +
            " CodeElements through the CodeModel";
        prjs = prj.Collection;
        msg += "\nThere are " + prjs.Count.ToString() + " projects in the same collection.";
        msg += "\nApplication containing this project: " + prj.DTE.Name;
        if (prj.Saved)
            msg += "\nThis project hasn't been modified since the last save.";
        else
            msg += "\nThis project has been modified since the last save.";
        msg += "\nProperties: ";
        foreach (Property prop in prj.Properties)
        {
            msg += "\n  " + prop.Name;
        }
        foreach (String s in (Array)prj.Globals.VariableNames)
        {
            msg2 += "\n  " + s;
        }

        MessageBox.Show(msg, "Project Name: " + prj.Name);
        MessageBox.Show(msg2);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft