RunningDocumentTable.SaveFileIfDirty Method

Saves the specified file if it has changed since the last save.

Namespace:  Microsoft.VisualStudio.Shell
Assemblies:   Microsoft.VisualStudio.Shell (in Microsoft.VisualStudio.Shell.dll)
  Microsoft.VisualStudio.Shell.10.0 (in Microsoft.VisualStudio.Shell.10.0.dll)
  Microsoft.VisualStudio.Shell.9.0 (in Microsoft.VisualStudio.Shell.9.0.dll)

Syntax

声明
Public Function SaveFileIfDirty ( _
    fullPath As String _
) As String
用法
Dim instance As RunningDocumentTable
Dim fullPath As String
Dim returnValue As String

returnValue = instance.SaveFileIfDirty(fullPath)
public string SaveFileIfDirty(
    string fullPath
)
public:
String^ SaveFileIfDirty(
    String^ fullPath
)
member SaveFileIfDirty : 
        fullPath:string -> string 
public function SaveFileIfDirty(
    fullPath : String
) : String

Parameters

  • fullPath
    Type: System.String
    [in] The full path to the document to be saved.

Return Value

Type: System.String
The path to which the file was saved. This is either the original path or a new path specified by the user.

Remarks

This method attempts to use the IVsPersistDocData2 interface from the document to save the document. If the IVsPersistDocData2 interface cannot be obtained from the document then the original path is returned. If the save fails for any reason or the document is not dirty, then the original path is returned. If the save succeeds, the path to which the document was saved is returned. In other words, there is no way to determine from this method if the document was saved or not.

.NET Framework Security

See Also

Reference

RunningDocumentTable Class

RunningDocumentTable Members

Microsoft.VisualStudio.Shell Namespace