IVsTextStream.CanReplaceStream Method
Tests whether a given editing operation can succeed (for example, copy or cut).
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Declaração
Function CanReplaceStream ( _
iPos As Integer, _
iOldLen As Integer, _
iNewLen As Integer _
) As Integer
int CanReplaceStream(
int iPos,
int iOldLen,
int iNewLen
)
int CanReplaceStream(
[InAttribute] int iPos,
[InAttribute] int iOldLen,
[InAttribute] int iNewLen
)
abstract CanReplaceStream :
iPos:int *
iOldLen:int *
iNewLen:int -> int
function CanReplaceStream(
iPos : int,
iOldLen : int,
iNewLen : int
) : int
Parameters
- iPos
Type: System.Int32
[in] Position in the text buffer.
- iOldLen
Type: System.Int32
[in] Length of text to replace, if any. In an insert operation, this value is zero (0).
- iNewLen
Type: System.Int32
[in] Length of the newly inserted text.
Return Value
Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
From textmgr.idl:
HRESULT IVsTextStream::CanReplaceStream(
[in] long iPos,
[in] long iOldLen,
[in] long iNewLen
);
In the text buffer, every change is modeled as a replace operation, regardless of whether text is inserted, replaced, or deleted within the line. As such, this method contains a starting position in the text buffer (iPos) and a length of text to replace (iOldLen). To test for an insert operation, set iOldLen to zero (0). To test whether text can be deleted, set iNewLen to zero (0) and then iOldLen would be greater than zero (0).
CanReplaceStream is used to test whether a given editing operation (for example, cut or copy) can succeed. Potential causes for failure include attempting to replace text in a read-only buffer (file is under source control), or attempting to replace text in a read-only region within the buffer.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.