다음을 통해 공유


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%

    [in, out] 유니코드 문자의 개수에 대 한 포인터-바이트 없습니다.

반환 값

형식: 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 보안

참고 항목

참조

IVsTextLines 인터페이스

Microsoft.VisualStudio.TextManager.Interop 네임스페이스