แก้ไข

แชร์ผ่าน


ToolboxService.GetToolboxItems Method

Definition

Returns an ICollection of ToolboxItem objects.

Overloads

GetToolboxItems(Assembly, String, Boolean)

Returns an ICollection of ToolboxItem objects for the given assembly.

GetToolboxItems(AssemblyName, Boolean)

Returns an ICollection of ToolboxItem objects for the given assembly.

GetToolboxItems(AssemblyName)

Returns an ICollection of ToolboxItem objects for the given assembly.

GetToolboxItems(Assembly, String)

Returns an ICollection containing all the toolbox items in the given assembly.

GetToolboxItems(Assembly, String, Boolean)

Returns an ICollection of ToolboxItem objects for the given assembly.

public:
 static System::Collections::ICollection ^ GetToolboxItems(System::Reflection::Assembly ^ a, System::String ^ newCodeBase, bool throwOnError);
public static System.Collections.ICollection GetToolboxItems (System.Reflection.Assembly a, string newCodeBase, bool throwOnError);
static member GetToolboxItems : System.Reflection.Assembly * string * bool -> System.Collections.ICollection
Public Shared Function GetToolboxItems (a As Assembly, newCodeBase As String, throwOnError As Boolean) As ICollection

Parameters

a
Assembly

The assembly to enumerate.

newCodeBase
String

A string that is the URL location of the assembly.

throwOnError
Boolean

true to throw an exception on error; otherwise, false.

Returns

A collection containing all the toolbox items in the assembly represented by the given assembly name.

Exceptions

Remarks

The GetToolboxItems method scans the assembly for all types that support toolbox items, and return items for those types. To support a toolbox item, a type must have the following characteristics:

Assemblies are locked for the duration of a process, so enumerating various files through GetToolboxItems can cause many assemblies to be loaded. The GetToolboxItems methods that take an assembly name create a separate AppDomain to search assemblies. When you are finished enumerating ToolboxItem objects for a set of assemblies, you can call the UnloadToolboxItems method, which unloads the AppDomain and frees the file references on the loaded assemblies.

Applies to

GetToolboxItems(AssemblyName, Boolean)

Returns an ICollection of ToolboxItem objects for the given assembly.

public:
 static System::Collections::ICollection ^ GetToolboxItems(System::Reflection::AssemblyName ^ an, bool throwOnError);
public static System.Collections.ICollection GetToolboxItems (System.Reflection.AssemblyName an, bool throwOnError);
static member GetToolboxItems : System.Reflection.AssemblyName * bool -> System.Collections.ICollection
Public Shared Function GetToolboxItems (an As AssemblyName, throwOnError As Boolean) As ICollection

Parameters

an
AssemblyName

An assembly name from which to load an assembly.

throwOnError
Boolean

true to throw an exception on error; otherwise, false.

Returns

A collection containing all the toolbox items in the assembly represented by the given assembly name.

Exceptions

an is null.

Remarks

The GetToolboxItems method scans the assembly for all types that support toolbox items, and return items for those types. To support a toolbox item, a type must have the following characteristics:

Assemblies are locked for the duration of a process, so enumerating various files through GetToolboxItems can cause many assemblies to be loaded. The GetToolboxItems methods that take an assembly name create a separate AppDomain to search assemblies. When you are finished enumerating ToolboxItem objects for a set of assemblies, you can call the UnloadToolboxItems method, which unloads the AppDomain and frees the file references on the loaded assemblies.

Applies to

GetToolboxItems(AssemblyName)

Returns an ICollection of ToolboxItem objects for the given assembly.

public:
 static System::Collections::ICollection ^ GetToolboxItems(System::Reflection::AssemblyName ^ an);
public static System.Collections.ICollection GetToolboxItems (System.Reflection.AssemblyName an);
static member GetToolboxItems : System.Reflection.AssemblyName -> System.Collections.ICollection
Public Shared Function GetToolboxItems (an As AssemblyName) As ICollection

Parameters

an
AssemblyName

An assembly name from which to load an assembly.

Returns

A collection containing all the toolbox items in the assembly represented by the given assembly name.

Exceptions

an is null.

Remarks

The GetToolboxItems method scans the assembly for all types that support toolbox items, and return items for those types. To support a toolbox item, a type must have the following characteristics:

Assemblies are locked for the duration of a process, so enumerating various files through GetToolboxItems can cause many assemblies to be loaded. The GetToolboxItems methods that take an assembly name create a separate AppDomain to search assemblies. When you are finished enumerating ToolboxItem objects for a set of assemblies, you can call the UnloadToolboxItems method, which unloads the AppDomain and frees the file references on the loaded assemblies.

Assemblies loaded in this manner are loaded into a separate AppDomain so they can later be unloaded. This only momentarily locks the assembly file.

See also

Applies to

GetToolboxItems(Assembly, String)

Returns an ICollection containing all the toolbox items in the given assembly.

public:
 static System::Collections::ICollection ^ GetToolboxItems(System::Reflection::Assembly ^ a, System::String ^ newCodeBase);
public static System.Collections.ICollection GetToolboxItems (System.Reflection.Assembly a, string newCodeBase);
static member GetToolboxItems : System.Reflection.Assembly * string -> System.Collections.ICollection
Public Shared Function GetToolboxItems (a As Assembly, newCodeBase As String) As ICollection

Parameters

a
Assembly

The assembly to enumerate.

newCodeBase
String

A string that is the URL location of the assembly.

Returns

A collection containing all the toolbox items in the given assembly.

Exceptions

Remarks

The GetToolboxItems method scans the assembly for all types that support toolbox items, and return items for those types. To support a toolbox item, a type must have the following characteristics:

Assemblies are locked for the duration of a process, so enumerating various files through GetToolboxItems can cause many assemblies to be loaded. The GetToolboxItems methods that take an assembly name create a separate AppDomain to search assemblies. When you are finished enumerating ToolboxItem objects for a set of assemblies, you can call the UnloadToolboxItems method, which unloads the AppDomain and frees the file references on the loaded assemblies.

See also

Applies to