ToolboxService.GetToolboxItems 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回 ICollection 对象的 ToolboxItem。
GetToolboxItems(Assembly, String, Boolean) |
返回给定程序集的 ICollection 对象的 ToolboxItem。 |
GetToolboxItems(AssemblyName, Boolean) |
返回给定程序集的 ICollection 对象的 ToolboxItem。 |
GetToolboxItems(AssemblyName) |
返回给定程序集的 ICollection 对象的 ToolboxItem。 |
GetToolboxItems(Assembly, String) |
返回包含给定程序集中的所有工具箱项的 ICollection。 |
返回给定程序集的 ICollection 对象的 ToolboxItem。
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
参数
- a
- Assembly
要枚举的程序集。
- newCodeBase
- String
一个字符串,它是程序集的 URL 位置。
- throwOnError
- Boolean
如果在出现错误时引发异常,则为 true
;否则为 false
。
返回
一个集合,包含以给定的程序集名称表示的程序集中的所有工具箱项。
例外
a
为 null
。
注解
方法 GetToolboxItems 扫描程序集中支持工具箱项的所有类型,并返回这些类型的项。 若要支持工具箱项,类型必须具有以下特征:
公开。
实现 IComponent。
不是抽象的。
ToolboxItemAttribute没有在其类型上将
false
设置为 。不包含泛型参数。
程序集在进程期间处于锁定状态,因此通过 枚举各种文件 GetToolboxItems 可能会导致加载许多程序集。 采用 GetToolboxItems 程序集名称的方法创建一 AppDomain 个单独的方法来搜索程序集。 完成枚举 ToolboxItem 一组程序集的对象后,可以调用 UnloadToolboxItems 方法,该方法卸载 AppDomain 并释放已加载程序集上的文件引用。
适用于
返回给定程序集的 ICollection 对象的 ToolboxItem。
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
参数
- an
- AssemblyName
加载程序集时使用的程序集名称。
- throwOnError
- Boolean
如果在出现错误时引发异常,则为 true
;否则为 false
。
返回
一个集合,包含以给定的程序集名称表示的程序集中的所有工具箱项。
例外
an
为 null
。
注解
方法 GetToolboxItems 扫描程序集中支持工具箱项的所有类型,并返回这些类型的项。 若要支持工具箱项,类型必须具有以下特征:
公开。
实现 IComponent。
不是抽象的。
ToolboxItemAttribute没有在其类型上将
false
设置为 。不包含泛型参数。
程序集在进程期间处于锁定状态,因此通过 枚举各种文件 GetToolboxItems 可能会导致加载许多程序集。 采用 GetToolboxItems 程序集名称的方法创建一 AppDomain 个单独的方法来搜索程序集。 完成枚举 ToolboxItem 一组程序集的对象后,可以调用 UnloadToolboxItems 方法,该方法卸载 AppDomain 并释放已加载程序集上的文件引用。
适用于
返回给定程序集的 ICollection 对象的 ToolboxItem。
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
参数
- an
- AssemblyName
加载程序集时使用的程序集名称。
返回
一个集合,包含以给定的程序集名称表示的程序集中的所有工具箱项。
例外
an
为 null
。
注解
方法 GetToolboxItems 扫描程序集中支持工具箱项的所有类型,并返回这些类型的项。 若要支持工具箱项,类型必须具有以下特征:
公开。
实现 IComponent。
不是抽象的。
ToolboxItemAttribute没有在其类型上将
false
设置为 。不包含泛型参数。
程序集在进程期间处于锁定状态,因此通过 枚举各种文件 GetToolboxItems 可能会导致加载许多程序集。 采用 GetToolboxItems 程序集名称的方法创建一 AppDomain 个单独的方法来搜索程序集。 完成枚举 ToolboxItem 一组程序集的对象后,可以调用 UnloadToolboxItems 方法,该方法卸载 AppDomain 并释放已加载程序集上的文件引用。
以这种方式加载的程序集将加载到单独的 AppDomain 中,以便以后可以卸载它们。 这只会暂时锁定程序集文件。
另请参阅
适用于
返回包含给定程序集中的所有工具箱项的 ICollection。
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
参数
- a
- Assembly
要枚举的程序集。
- newCodeBase
- String
一个字符串,它是程序集的 URL 位置。
返回
一个集合,包含给定程序集中的所有工具箱项。
例外
a
为 null
。
注解
方法 GetToolboxItems 扫描程序集中支持工具箱项的所有类型,并返回这些类型的项。 若要支持工具箱项,类型必须具有以下特征:
公开。
实现 IComponent。
不是抽象的。
ToolboxItemAttribute没有在其类型上将
false
设置为 。不包含泛型参数。
程序集在进程期间处于锁定状态,因此通过 枚举各种文件 GetToolboxItems 可能会导致加载许多程序集。 采用 GetToolboxItems 程序集名称的方法创建一 AppDomain 个单独的方法来搜索程序集。 完成枚举 ToolboxItem 一组程序集的对象后,可以调用 UnloadToolboxItems 方法,该方法卸载 AppDomain 并释放已加载程序集上的文件引用。