共用方式為


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
長度為 length 的字串,這個字串起始於基礎 ITextBuffer 中的 startIndex。

例外狀況

例外狀況 條件
ArgumentOutOfRangeException

startIndex小於零或大於長度的快照集,或length小於零,或startIndex加上length大於快照集的長度。

.NET Framework 安全性

請參閱

參考

ITextSnapshot 介面

GetText 多載

Microsoft.VisualStudio.Text 命名空間