ComUnregisterFunctionAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)

<AttributeUsageAttribute(AttributeTargets.Method, Inherited:=False)> _ <ComVisibleAttribute(True)> _ Public NotInheritable Class ComUnregisterFunctionAttribute Inherits Attribute
[AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)] [ComVisibleAttribute(true)] public sealed class ComUnregisterFunctionAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Method, Inherited=false)] [ComVisibleAttribute(true)] public ref class ComUnregisterFunctionAttribute sealed : public Attribute

ComUnregisterFunctionAttribute を使用すると、登録メソッドが実行した操作を元に戻すためのコードを追加できます。ComRegisterFunctionAttribute を適用して登録メソッドを提供する場合は、その登録メソッドで実行された操作を元に戻すための登録解除メソッドも提供する必要があります。登録解除メソッドは 1 クラスにつき 1 つしか提供できません。
格納しているアセンブリが アセンブリ登録ツール (Regasm.exe) や RegistrationServices.UnregisterAssembly API メソッドを使用して (直接または間接的に) 登録解除される場合、共通言語ランタイムはこの属性を持つメソッドを呼び出します。この属性を持つメソッドの参照可能範囲 (パブリック、プライベートなど) は任意ですが、このメソッドは static である必要があり、登録解除する Type を表す Type パラメータを 1 つ受け取る必要があります。

適切なシグネチャを持つメソッドに ComRegisterFunctionAttribute と ComUnregisterFunctionAttribute を適用する例を次に示します。
Imports System Imports System.Runtime.InteropServices Public Class MyClassThatNeedsToRegister <ComRegisterFunctionAttribute()> Public Shared Sub _ RegisterFunction(t As Type) 'Insert code here. End Sub <ComUnregisterFunctionAttribute()> Public Shared Sub _ UnregisterFunction(t As Type) 'Insert code here. End Sub End Class
using System; using System.Runtime.InteropServices; public class MyClassThatNeedsToRegister { [ComRegisterFunctionAttribute] public static void RegisterFunction(Type t) { //Insert code here. } [ComUnregisterFunctionAttribute] public static void UnregisterFunction(Type t) { //Insert code here. } }
using namespace System; using namespace System::Runtime::InteropServices; public ref class MyClassThatNeedsToRegister { public: [ComRegisterFunctionAttribute] static void RegisterFunction( Type^ t ) { //Insert code here. } [ComUnregisterFunctionAttribute] static void UnregisterFunction( Type^ t ) { //Insert code here. } };
import System.*; import System.Runtime.InteropServices.*; public class MyClassThatNeedsToRegister { /** @attribute ComRegisterFunctionAttribute() */ public static void RegisterFunction(Type t) { //Insert code here. } //RegisterFunction /** @attribute ComUnregisterFunctionAttribute() */ public static void UnregisterFunction(Type t) { //Insert code here. } //UnregisterFunction } //MyClassThatNeedsToRegister
import System; import System.Runtime.InteropServices; public class MyClassThatNeedsToRegister { ComRegisterFunctionAttribute public static function RegisterFunction(t : Type) : void { //Insert code here. } ComUnregisterFunctionAttribute public static function UnregisterFunction(t : Type) : void { //Insert code here. } }

System.Attribute
System.Runtime.InteropServices.ComUnregisterFunctionAttribute


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ComUnregisterFunctionAttribute クラスのページへのリンク