NewDocumentStateScope Constructor (__VSNEWDOCUMENTSTATE, Guid)

 

Initializes a new instance of the NewDocumentStateScope class.

Namespace:   Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.14.0 (in Microsoft.VisualStudio.Shell.14.0.dll)

public:
NewDocumentStateScope(
	__VSNEWDOCUMENTSTATE state,
	Guid reason
)

Parameters

state
Type: Microsoft.VisualStudio.Shell.Interop::__VSNEWDOCUMENTSTATE

State used for the next document to be opened.

reason
Type: System::Guid

Reason the state is being set (typically this is a tool window or language service GUID).

The following code shows how to set up a context in which a new document can be opened provisionally.

using (new NewDocumentStateScope (__VSNEWDOCUMENTSTATE.NDS_Provisional,VSConstants.NewDocumentStateReason.Navigation))
{
    // open the document -- it will be provisional
}
Return to top
Show: