Share via


XmlStore.BeginEditingScope Method (String, Object)

 

Begins a new editing operation on one or more models in this XmlStore.

Namespace:   Microsoft.VisualStudio.XmlEditor
Assembly:  Microsoft.VisualStudio.XmlEditor (in Microsoft.VisualStudio.XmlEditor.dll)

Syntax

public abstract XmlEditingScope BeginEditingScope(
    string name,
    object state
)
public:
virtual XmlEditingScope^ BeginEditingScope(
    String^ name,
    Object^ state
) abstract
abstract BeginEditingScope : 
        name:string *
        state:Object -> XmlEditingScope
Public MustOverride Function BeginEditingScope (
    name As String,
    state As Object
) As XmlEditingScope

Parameters

  • name
    Type: System.String

    The name of the M:Microsoft.VisualStudio.XmlEditor.XmlStore.BeginEditingScope.

  • state
    Type: System.Object

    A user defined object that you want to associate with this editing scope. This is useful for re-discovering context during an undo operation.

Return Value

Type: Microsoft.VisualStudio.XmlEditor.XmlEditingScope

A new XmlEditingScope object.

Remarks

You can also use this M:Microsoft.VisualStudio.XmlEditor.XmlStore.BeginEditingScope to lock a parse tree so you can get a consistent snapshot in a read-only scenario. The XML Editor will not change the trees in the XmlStore on the background parse thread while this XmlEditingScope is active. Call Complete when you are done. If an exception is thrown, the edits performed on the tree while this XmlEditingScope was active will be reverted automatically.

You can call this method multiple times from different places in your code to create nested XmlEditingScope objects. The EditingScopeCompleted event will not be raised until the top-most XmlEditingScope object is completed and the nested XmlEditingScope objects all get rolled up into one undo unit.

See Also

XmlStore Class
Microsoft.VisualStudio.XmlEditor Namespace

Return to top