IRegistrationServices.RegisterAssembly 方法

定義

註冊 Managed 組件中的類別,以啟用從 COM 的建立。

public:
 bool RegisterAssembly(System::Reflection::Assembly ^ assembly, System::Runtime::InteropServices::AssemblyRegistrationFlags flags);
public bool RegisterAssembly (System.Reflection.Assembly assembly, System.Runtime.InteropServices.AssemblyRegistrationFlags flags);
[System.Security.SecurityCritical]
public bool RegisterAssembly (System.Reflection.Assembly assembly, System.Runtime.InteropServices.AssemblyRegistrationFlags flags);
abstract member RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
[<System.Security.SecurityCritical>]
abstract member RegisterAssembly : System.Reflection.Assembly * System.Runtime.InteropServices.AssemblyRegistrationFlags -> bool
Public Function RegisterAssembly (assembly As Assembly, flags As AssemblyRegistrationFlags) As Boolean

參數

assembly
Assembly

要登錄的組件。

flags
AssemblyRegistrationFlags

AssemblyRegistrationFlags 值,表示在註冊 assembly 時所需要的任何特殊設定。

傳回

如果 assembly 含有成功登錄的型別,則為 true,否則為 false (如果組件沒有包含合適的型別)。

屬性

例外狀況

assemblynull

assembly 的完整名稱是 null

-或-

ComRegisterFunctionAttribute 標記的方法不是 static

-或-

在階層架構的指定層級中,有一個以上的方法是以 ComRegisterFunctionAttribute 標記。

-或-

ComRegisterFunctionAttribute 標記之方法的簽章無效。

備註

RegisterAssembly 會為指定元件中的型別加入適當的登錄專案。 這個方法也會呼叫元件中找到的任何註冊函式。

使用 Assembly.Load 取得元件。

適用於