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)

IProjectionSnapshot Insert(
	int position,
	string text
)

Parameters

position
Type: Int32

The buffer position at which the first character of the text will appear.

text
Type: String

The text to be inserted.

ExceptionCondition
ArgumentNullException

text is null.

ArgumentOutOfRangeException

position is less than zero or greater than the length of the buffer.

InvalidOperationException

A ITextEdit is currently active.

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft