共用方式為


IProjectionBufferBase.Insert(Int32, String) Method

Definition

Inserts the given text at the specified position in the ITextBuffer.

public:
 Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot ^ Insert(int position, System::String ^ text);
public:
 Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot ^ Insert(int position, Platform::String ^ text);
Microsoft::VisualStudio::Text::Projection::IProjectionSnapshot Insert(int position, std::wstring const & text);
public Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot Insert (int position, string text);
abstract member Insert : int * string -> Microsoft.VisualStudio.Text.Projection.IProjectionSnapshot
Public Function Insert (position As Integer, text As String) As IProjectionSnapshot

Parameters

position
Int32

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

text
String

The text to be inserted.

Returns

An IProjectionSnapshot.

Exceptions

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

text is null.

A TextEdit 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.

Applies to