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
- project
Type: EnvDTE.Project
The Project to obtain global objects from.
- 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.