ITextSnapshot.GetText 方法 (Int32, Int32)

从一个快照获取文本开始在 startIndex 和长度等于 length。

命名空间:  Microsoft.VisualStudio.Text
程序集:  Microsoft.VisualStudio.Text.Data(在 Microsoft.VisualStudio.Text.Data.dll 中)

语法

声明
Function GetText ( _
    startIndex As Integer, _
    length As Integer _
) As String
string GetText(
    int startIndex,
    int length
)
String^ GetText(
    int startIndex, 
    int length
)
abstract GetText : 
        startIndex:int * 
        length:int -> string
function GetText(
    startIndex : int, 
    length : int
) : String

参数

  • startIndex
    类型:Int32

    起始索引。

  • length
    类型:Int32

    要获取的文本的长度。

返回值

类型:String
从基础 ITextBuffer 中的 startIndex 处开始且长度为 length 的字符串。

异常

异常 条件
ArgumentOutOfRangeException

startIndex 大于零的小于或大于快照的长度,或者 length 小于零,或 startIndex 以及 length 大于快照的长度。

.NET Framework 安全性

请参阅

参考

ITextSnapshot 接口

GetText 重载

Microsoft.VisualStudio.Text 命名空间