个文件的内容在磁盘上为文本缓冲区中的插入。
命名空间: Microsoft.VisualStudio.Text.Operations
程序集: Microsoft.VisualStudio.Text.UI(在 Microsoft.VisualStudio.Text.UI.dll 中)
语法
声明
Function InsertFile ( _
filePath As String _
) As Boolean
bool InsertFile(
string filePath
)
bool InsertFile(
String^ filePath
)
abstract InsertFile :
filePath:string -> bool
function InsertFile(
filePath : String
) : boolean
参数
filePath
类型:String文件在磁盘上的路径。
返回值
类型:Boolean
如果编辑成功,则为 true;否则为 false。
异常
异常 | 条件 |
---|---|
DirectoryNotFoundException | 指定的路径无效(例如,它位于未映射的驱动器上)。 |
ArgumentException | filePath 是一个零长度字符串,仅包含空白或者包含一个或多个由 GetInvalidPathChars 定义的无效字符。 |
FileNotFoundException | 未找到 filePath 中指定的文件。 |
SecurityException | 调用方没有所要求的权限。 |
PathTooLongException | 指定的路径、文件名或者两者都超出了系统定义的最大长度。 例如,在基于 Windows 的平台上,路径必须小于 248 个字符,文件名必须小于 260 个字符。 |
UnauthorizedAccessException | filePath 指定只读的文件,或者此操作将当前平台不支持,或者 filePath 指定内容,或调用方没有必需的权限。 |
IOException | 打开文件时发生 I/O 错误。 |
ArgumentNullException | filePath 为 nullnull 引用(在 Visual Basic 中为 Nothing)。 |
NotSupportedException | filePath 的格式无效。 |
.NET Framework 安全性
- 对直接调用方的完全信任。此成员不能由部分信任的代码使用。有关详细信息,请参阅通过部分受信任的代码使用库。