共用方式為


GlobalObject.Instance Property

Gets an on-demand created instance of the global object.

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

Syntax

'宣告
Public ReadOnly Property Instance As Object
public Object Instance { get; }

Property Value

Type: System.Object
An Object that represents an instance of the global object class.

Exceptions

Exception Condition
InvalidOperationException

The resulting instance is not serializable, which indicates an incorrect implementation.

Remarks

You can use the Instance property to create an actual instance of the global object represented by the current global object. This property is nulla null reference (Nothing in Visual Basic) if the global objects contains only static members.

A new instance is only created the first time this property is retrieved. Subsequent retrievals get the same object unless one or more of the PerformChange, PerformRemove or ClearInstance methods are called in the intervening period.

If a new instance is created that is not nulla null reference (Nothing in Visual Basic), then a Created event is raised.

.NET Framework Security

See Also

Reference

GlobalObject Class

Microsoft.VisualStudio.Shell.Design Namespace

Type.IsSerializable

Created