将 TextBuffer 的内容保存到给定的 filePath。
命名空间: Microsoft.VisualStudio.Text
程序集: Microsoft.VisualStudio.Text.Data(在 Microsoft.VisualStudio.Text.Data.dll 中)
语法
声明
Sub SaveCopy ( _
filePath As String, _
overwrite As Boolean _
)
void SaveCopy(
string filePath,
bool overwrite
)
void SaveCopy(
String^ filePath,
bool overwrite
)
abstract SaveCopy :
filePath:string *
overwrite:bool -> unit
function SaveCopy(
filePath : String,
overwrite : boolean
)
参数
filePath
类型:String文件名。
overwrite
类型:Boolean如果在 filePath 存在的情况下应覆盖它,则为 true;否则为 false。
异常
异常 | 条件 |
---|---|
ArgumentNullException | filePath 为 nullnull 引用(在 Visual Basic 中为 Nothing)。 |
UnauthorizedAccessException | 在保存的文件中,访问错误。 |
IOException | I/O 错误时 (尝试导致的错误包括复盖现有文件,并且 overwrite 是 false时)。 |
ObjectDisposedException | 此对象已被释放。 |
备注
此调用不会影响 IsDirty、 LastSavedTime和 FilePath 属性。
不引发 FileActionOccurred 事件。
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。