共用方式為


GlobalObjectService.GetGlobalObjects Method (Type)

Returns a collection of currently available global objects that are of the specified type.

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

Syntax

'Declaration
Public Function GetGlobalObjects ( _
    baseType As Type _
) As GlobalObjectCollection
public GlobalObjectCollection GetGlobalObjects(
    Type baseType
)
public:
GlobalObjectCollection^ GetGlobalObjects(
    Type^ baseType
)
member GetGlobalObjects : 
        baseType:Type -> GlobalObjectCollection
public function GetGlobalObjects(
    baseType : Type
) : GlobalObjectCollection

Parameters

Return Value

Type: Microsoft.VisualStudio.Shell.Design.GlobalObjectCollection
A GlobalObjectCollection containing the currently available global objects.

Exceptions

Exception Condition
NotSupportedException

One of the queried global service provider factories returned nulla null reference (Nothing in Visual Basic) provider or provider collection.

Remarks

The GetGlobalObjects(Type) method returns a GlobalObjectCollection of the currently available instances of the GlobalObject class that are of the type specified by the baseType parameter. This collection is created each time this method is called. When the method is called, the method synchronizes the collection with the set of global object providers.

GetGlobalObjects never returns nulla null reference (Nothing in Visual Basic); if there are no currently available global objects, this method returns an empty collection.

GetGlobalObjects is typically used by design-time tools to initiate the following set of actions:

  1. A call to the GetProviders method of the GlobalObjectProviderFactory class is made.

  2. In response, the provider factory creates the required GlobalObjectProvider instances if they do not already exist.

  3. GetProviders returns the array of global object providers.

  4. GetGlobalObjects method calls the GlobalObjectProvider.GetGlobalObjects method for each provider. Finally it aggregates the results which it then returns.

.NET Framework Security

See Also

Reference

GlobalObjectService Class

GetGlobalObjects Overload

Microsoft.VisualStudio.Shell.Design Namespace

GetGlobalTypes

GlobalObject

GlobalObjectCollection

GlobalObjectProvider

GlobalObjectProvider.GetGlobalObjects