ComUnregisterFunctionAttributeとは? わかりやすく解説

ComUnregisterFunctionAttribute クラス

COM で使用できるように登録したアセンブリの登録を解除するときに呼び出すメソッドを指定します。これにより、登録解除中にユーザー記述コードを実行できます。

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Method, Inherited:=False)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class
 ComUnregisterFunctionAttribute
    Inherits Attribute
Dim instance As ComUnregisterFunctionAttribute
[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
/** @attribute AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 */ 
/** @attribute ComVisibleAttribute(true) */ 
public final class ComUnregisterFunctionAttribute
 extends Attribute
AttributeUsageAttribute(AttributeTargets.Method, Inherited=false)
 
ComVisibleAttribute(true) 
public final class ComUnregisterFunctionAttribute
 extends 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.Object
   System.Attribute
    System.Runtime.InteropServices.ComUnregisterFunctionAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ComUnregisterFunctionAttribute メンバ
System.Runtime.InteropServices 名前空間
ComRegisterFunctionAttribute クラス
RegistrationServices.UnregisterAssembly
その他の技術情報
アセンブリ登録ツール (Regasm.exe)

ComUnregisterFunctionAttribute コンストラクタ

ComUnregisterFunctionAttribute クラスの新しいインスタンスを初期化します。

名前空間: System.Runtime.InteropServices
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As New ComUnregisterFunctionAttribute
public ComUnregisterFunctionAttribute ()
public:
ComUnregisterFunctionAttribute ()
public ComUnregisterFunctionAttribute ()
public function ComUnregisterFunctionAttribute
 ()
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ComUnregisterFunctionAttribute クラス
ComUnregisterFunctionAttribute メンバ
System.Runtime.InteropServices 名前空間

ComUnregisterFunctionAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。)
参照参照

関連項目

ComUnregisterFunctionAttribute クラス
System.Runtime.InteropServices 名前空間
ComRegisterFunctionAttribute クラス
RegistrationServices.UnregisterAssembly

その他の技術情報

アセンブリ登録ツール (Regasm.exe)

ComUnregisterFunctionAttribute メソッド


パブリック メソッドパブリック メソッド

  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 ( Object から継承されます。)
参照参照

関連項目

ComUnregisterFunctionAttribute クラス
System.Runtime.InteropServices 名前空間
ComRegisterFunctionAttribute クラス
RegistrationServices.UnregisterAssembly

その他の技術情報

アセンブリ登録ツール (Regasm.exe)

ComUnregisterFunctionAttribute メンバ

COM で使用できるように登録したアセンブリの登録を解除するときに呼び出すメソッドを指定します。これにより、登録解除中にユーザー記述コードを実行できます。

ComUnregisterFunctionAttribute データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ComUnregisterFunctionAttribute ComUnregisterFunctionAttribute クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ TypeId  派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。)
パブリック メソッドパブリック メソッド
  名前 説明
パブリック メソッド Equals  オーバーロードされます。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttribute  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode  このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。)
パブリック メソッド GetType  現在のインスタンスの Type を取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String を返します。 (Object から継承されます。)
参照参照

関連項目

ComUnregisterFunctionAttribute クラス
System.Runtime.InteropServices 名前空間
ComRegisterFunctionAttribute クラス
RegistrationServices.UnregisterAssembly

その他の技術情報

アセンブリ登録ツール (Regasm.exe)



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「ComUnregisterFunctionAttribute」の関連用語

ComUnregisterFunctionAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ComUnregisterFunctionAttributeのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS