ITextDocument.SaveAs Method (String, Boolean)
Saves the contents of the TextBuffer to the specified file path.
Namespace: Microsoft.VisualStudio.Text
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
‘선언
Sub SaveAs ( _
filePath As String, _
overwrite As Boolean _
)
void SaveAs(
string filePath,
bool overwrite
)
void SaveAs(
String^ filePath,
bool overwrite
)
abstract SaveAs :
filePath:string *
overwrite:bool -> unit
function SaveAs(
filePath : String,
overwrite : boolean
)
Parameters
- filePath
Type: System.String
The name of the new file.
- overwrite
Type: System.Boolean
true if filePath should be overwritten if it exists, otherwise false.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | This object is in the middle of raising events. |
ArgumentNullException | filePath is null. |
UnauthorizedAccessException | An access error occurred during file save. |
IOException | An I/O error occurred (including an error caused by attempting to overwrite an existing file when overwrite is false). |
ObjectDisposedException | This object has been disposed. |
Remarks
If the save operation is successful, FilePath is set to filePath, and IsDirty is set to false. If the save operation fails, FilePath and IsDirty remains unchanged.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.