共用方式為


GlobalObjectProvider.GetGlobalObjects Method (Project, Type)

Gets a collection of global objects for the specified project that match the specified type.

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

Syntax

'宣告
Public Function GetGlobalObjects ( _
    project As Project, _
    baseType As Type _
) As GlobalObjectCollection
public GlobalObjectCollection GetGlobalObjects(
    Project project,
    Type baseType
)

Parameters

  • baseType
    Type: System.Type
    The Type of the GlobalObject to filter on. Can be nulla null reference (Nothing in Visual Basic) to indicate no filtering.

Return Value

Type: Microsoft.VisualStudio.Shell.Design.GlobalObjectCollection
A GlobalObjectCollection containing the global objects of the specified Type for the specified project.

Exceptions

Exception Condition
ArgumentNullException

project is nulla null reference (Nothing in Visual Basic).

InvalidOperationException

The implementation of GetGlobalObjectsCore returned nulla null reference (Nothing in Visual Basic).

Remarks

The GetGlobalObjects method provides a standard wrapper for the GetGlobalObjectsCore method. GetGlobalObjects will ignore all except the most critical exceptions thrown by the core method, namely NullReferenceException, StackOverflowException, OutOfMemoryException and ThreadAbortException.

Use the GetGlobalObjects method instead of the GetGlobalObjectsCore method since the former always returns a list even if the list is empty.

.NET Framework Security

See Also

Reference

GlobalObjectProvider Class

GetGlobalObjects Overload

Microsoft.VisualStudio.Shell.Design Namespace

GetGlobalObjectsCore

GetGlobalTypes

GlobalObjectCollection

GlobalObject