Freigeben über


ITextBufferEdit.Apply Method

Commits all the modifications made with this ITextBufferEdit object to the underlying ITextBuffer. It also causes the ITextBuffer to generate a new snapshot and raise its Changed event if any modifications were made.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Declaration
Function Apply As ITextSnapshot
ITextSnapshot Apply()
ITextSnapshot^ Apply()
abstract Apply : unit -> ITextSnapshot
function Apply() : ITextSnapshot

Return Value

Type: Microsoft.VisualStudio.Text.ITextSnapshot
A snapshot of the state of the ITextBuffer after the change is applied. If there was no change, or edit was canceled, no new snapshot will be generated, and the previous snapshot will be returned.

Exceptions

Exception Condition
InvalidOperationException

The Apply or Cancel or Dispose method has previously been called on this object.

Remarks

Canceled may be true after this method returns if a handler of the buffer's Changing event canceled the change.

This method may be called only once. After it is called, any other calls on this object (other than Dispose) will result in an InvalidOperationException.

.NET Framework Security

See Also

Reference

ITextBufferEdit Interface

Microsoft.VisualStudio.Text Namespace