TypeLibTypeAttribute クラス

定義

COM タイプ ライブラリからこの型用に元来インポートされた TYPEFLAGS を格納します。

public ref class TypeLibTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)]
public sealed class TypeLibTypeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeLibTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)>]
type TypeLibTypeAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeLibTypeAttribute = class
    inherit Attribute
Public NotInheritable Class TypeLibTypeAttribute
Inherits Attribute
継承
TypeLibTypeAttribute
属性

次の例では、クラスまたはインターフェイスの値を TypeLibTypeAttribute 取得する方法を示します。

using namespace System;
using namespace System::Runtime::InteropServices;

ref class ClassB
{
private:
   static bool IsHiddenInterface( Type^ InterfaceType )
   {
      array<Object^>^InterfaceAttributes = InterfaceType->GetCustomAttributes( TypeLibTypeAttribute::typeid, false );
      if ( InterfaceAttributes->Length > 0 )
      {
         TypeLibTypeAttribute^ tlt = dynamic_cast<TypeLibTypeAttribute^>(InterfaceAttributes[ 0 ]);
         TypeLibTypeFlags flags = tlt->Value;
         return (flags & TypeLibTypeFlags::FHidden) != TypeLibTypeFlags(0);
      }

      return false;
   }
};
using System;
using System.Runtime.InteropServices;

namespace B
{
    class ClassB	
    {
        public static bool IsHiddenInterface( Type InterfaceType )
        {
            object[] InterfaceAttributes = InterfaceType.GetCustomAttributes( typeof( TypeLibTypeAttribute ), false );
            if( InterfaceAttributes.Length > 0 )
            {
                TypeLibTypeAttribute tlt = ( TypeLibTypeAttribute ) InterfaceAttributes[0];
                TypeLibTypeFlags  flags = tlt.Value;
                return ( flags & TypeLibTypeFlags.FHidden ) != 0;
            }
            return false;
        }
    }
}

Imports System.Runtime.InteropServices

Module B
    Public Function IsHiddenInterface(ByVal InterfaceType As Type) As Boolean
        Dim InterfaceAttributes As Object() = _
        InterfaceType.GetCustomAttributes(GetType(TypeLibTypeAttribute), False)

        If InterfaceAttributes.Length > 0 Then
            Dim tlt As TypeLibTypeAttribute = InterfaceAttributes(0)
            Dim flags As TypeLibTypeFlags = tlt.Value
            Return (flags & TypeLibTypeFlags.FHidden) > 0
        End If

        Return False
    End Function
End Module

注釈

Tlbimp.exe (タイプ ライブラリ インポーター) は、この属性をクラスまたはインターフェイスに適用します。

この属性は、タイプ ライブラリがインポートされるときに適用され、変更しないでください。 メソッド TYPEFLAGS が 0 以外に評価された場合にのみ適用されます。 この属性は、元 TYPEFLAGS の設定方法を知る必要があるツールで使用するように設計されています。 共通言語ランタイムでは、この属性は使用されません。

コンストラクター

TypeLibTypeAttribute(Int16)

指定した TypeLibTypeFlags 値を使用して、TypeLibTypeAttribute クラスの新しいインスタンスを初期化します。

TypeLibTypeAttribute(TypeLibTypeFlags)

指定した TypeLibTypeFlags 値を使用して、TypeLibTypeAttribute クラスの新しいインスタンスを初期化します。

プロパティ

TypeId

派生クラスで実装されると、この Attribute の一意の識別子を取得します。

(継承元 Attribute)
Value

この型の TypeLibTypeFlags 値を取得します。

メソッド

Equals(Object)

このインスタンスが、指定されたオブジェクトと等価であるかどうかを示す値を返します。

(継承元 Attribute)
GetHashCode()

このインスタンスのハッシュ コードを返します。

(継承元 Attribute)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IsDefaultAttribute()

派生クラスでオーバーライドされるとき、このインスタンスの値が派生クラスの既定値であるかどうかを示します。

(継承元 Attribute)
Match(Object)

派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。

(継承元 Attribute)
MemberwiseClone()

現在の Object の簡易コピーを作成します。

(継承元 Object)
ToString()

現在のオブジェクトを表す文字列を返します。

(継承元 Object)

明示的なインターフェイスの実装

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

一連の名前を対応する一連のディスパッチ識別子に割り当てます。

(継承元 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

オブジェクトの型情報を取得します。この情報はインターフェイスの型情報の取得に使用できます。

(継承元 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

オブジェクトが提供する型情報インターフェイスの数 (0 または 1) を取得します。

(継承元 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

オブジェクトによって公開されたプロパティおよびメソッドへのアクセスを提供します。

(継承元 Attribute)

適用対象

こちらもご覧ください