IVsTextLines.CopyLineText 方法
將指定的文字範圍放到呼叫端配置的緩衝區 (陣列)。
命名空間: Microsoft.VisualStudio.TextManager.Interop
組件: Microsoft.VisualStudio.TextManager.Interop (在 Microsoft.VisualStudio.TextManager.Interop.dll 中)
語法
'宣告
Function CopyLineText ( _
iStartLine As Integer, _
iStartIndex As Integer, _
iEndLine As Integer, _
iEndIndex As Integer, _
pszBuf As IntPtr, _
<OutAttribute> ByRef pcchBuf As Integer _
) As Integer
int CopyLineText(
int iStartLine,
int iStartIndex,
int iEndLine,
int iEndIndex,
IntPtr pszBuf,
out int pcchBuf
)
int CopyLineText(
[InAttribute] int iStartLine,
[InAttribute] int iStartIndex,
[InAttribute] int iEndLine,
[InAttribute] int iEndIndex,
[InAttribute] IntPtr pszBuf,
[InAttribute] [OutAttribute] int% pcchBuf
)
abstract CopyLineText :
iStartLine:int *
iStartIndex:int *
iEndLine:int *
iEndIndex:int *
pszBuf:IntPtr *
pcchBuf:int byref -> int
function CopyLineText(
iStartLine : int,
iStartIndex : int,
iEndLine : int,
iEndIndex : int,
pszBuf : IntPtr,
pcchBuf : int
) : int
參數
iStartLine
類型:Int32[in]起始行。
iStartIndex
類型:Int32[in]起始的行內的字元索引。 必須是小於或等於線條的長度。
iEndLine
類型:Int32[in]結束行。
iEndIndex
類型:Int32[in]結束的行內的字元索引。 必須是小於或等於線條的長度。
pszBuf
類型:IntPtr[in]呼叫端配置的緩衝區指標。
pcchBuf
類型:Int32%輸入 [、 輸出]指標計數的 Unicode 字元,不是位元組。
傳回值
類型:Int32
如果此方法將會成功,則會傳回S_OK。如果失敗,它就會傳回錯誤碼。
備註
COM 簽章
從 textmgr.idl:
HRESULT IVsTextLines::CopyLineText(
[in] long iStartLine,
[in] CharIndex iStartIndex,
[in] long iEndLine,
[in] CharIndex iEndIndex,
[in] LPWSTR pszBuf,
[in, out] long *pcchBuf
);
若要判定需要保留指定的範圍的文字陣列的大小,請呼叫IVsTextLines.CopyLineText和傳入的起點和終點緩衝區中的位置和nullnull 參考 (即 Visual Basic 中的 Nothing)的pszBuf參數。 接著這個方法會傳回在陣列的大小pcchBuf參數。
這個方法會複製到pcchBuf您配置的緩衝區中的字元。 如果緩衝區並不夠大,無法存放這些字元,則這個方法會傳回BUFFER_E_DEST_TOO_SMALL ,並設定pcchBuf參數所需的大小。
![]() |
---|
CopyLineText方法不會附加nullnull 參考 (即 Visual Basic 中的 Nothing)到輸出字串。 |
IVsTextLines.CopyLineText因為最佳化因素需要緩衝區配置記憶體,例如方法上使用GetLineText。 如果是這種方法,文字緩衝區配置 BSTR 具有相當可觀的效能成本如果重複呼叫的方法。 對於IVsTextLines.CopyLineText,不過,您可以重複上複製您配置如果重複呼叫這個方法的緩衝區。
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。