IProjectionBufferBase.Insert Method
Inserts the specified text at the specified position in the ITextBuffer.
Namespace: Microsoft.VisualStudio.Text.Projection
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
'Declaration
Function Insert ( _
position As Integer, _
text As String _
) As IProjectionSnapshot
IProjectionSnapshot Insert(
int position,
string text
)
IProjectionSnapshot^ Insert(
int position,
String^ text
)
abstract Insert :
position:int *
text:string -> IProjectionSnapshot
function Insert(
position : int,
text : String
) : IProjectionSnapshot
Parameters
position
Type: Int32The buffer position at which the first character of the text will appear.
text
Type: StringThe text to be inserted.
Return Value
Type: Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot
An IProjectionSnapshot.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | text is nulla null reference (Nothing in Visual Basic). |
ArgumentOutOfRangeException | position is less than zero or greater than the length of the buffer. |
InvalidOperationException | A ITextEdit is currently active. |
Remarks
This is a shortcut for creating a new ITextEdit object, using it to insert the text, and then applying it. If the insertion fails on account of a read-only region, the snapshot returned will be the same as the current snapshot of the buffer before the attempted insertion.
.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.