ITextEdit.Insert Method (Int32, String)
Inserts the given text at the specified positionin the text buffer.
Namespace: Microsoft.VisualStudio.Text
Assembly: Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)
Syntax
‘선언
Function Insert ( _
position As Integer, _
text As String _
) As Boolean
bool Insert(
int position,
string text
)
bool Insert(
int position,
String^ text
)
abstract Insert :
position:int *
text:string -> bool
function Insert(
position : int,
text : String
) : boolean
Parameters
- position
Type: System.Int32
The buffer position at which the first character of the text will appear.
- text
Type: System.String
The text to be inserted.
Return Value
Type: System.Boolean
true if the insertion succeeded, false if it failed due to a read-only region.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | text is nulla null reference (Nothing in Visual Basic). |
InvalidOperationException | The Apply or Cancel or Dispose method has previously been called on this object. |
ArgumentOutOfRangeException | position is less than zero or greater than the length of the buffer. |
Remarks
Inserting an empty string will succeed, but will not generate a new snapshot or raise a Changed event.
.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.