TypeLibVarAttribute クラス

定義

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

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

次の例では、フィールドの値を取得する TypeLibVarAttribute 方法を示します。

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

ref class ClassD
{
public:
   static bool IsHiddenField( FieldInfo^ fi )
   {
      array<Object^>^FieldAttributes = fi->GetCustomAttributes( TypeLibVarAttribute::typeid, true );
      if ( FieldAttributes->Length > 0 )
      {
         TypeLibVarAttribute^ tlv = dynamic_cast<TypeLibVarAttribute^>(FieldAttributes[ 0 ]);
         TypeLibVarFlags flags = tlv->Value;
         return (flags & TypeLibVarFlags::FHidden) != (TypeLibVarFlags)0;
      }

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

namespace D
{
    class ClassD
    {
        public static bool IsHiddenField( FieldInfo fi )
        {
            object[] FieldAttributes = fi.GetCustomAttributes( typeof( TypeLibVarAttribute ), true);
        
            if( FieldAttributes.Length > 0 )
            {
                TypeLibVarAttribute tlv = ( TypeLibVarAttribute )FieldAttributes[0];
                TypeLibVarFlags  flags = tlv.Value;
                return ( flags & TypeLibVarFlags.FHidden ) != 0;
            }
            return false;
        }
    }
}
Imports System.Reflection
Imports System.Runtime.InteropServices

Module D
    Public Function IsHiddenField(ByVal fi As FieldInfo) As Boolean
        Dim FieldAttributes As Object() = fi.GetCustomAttributes(GetType(TypeLibVarAttribute), True)

        If FieldAttributes.Length > 0 Then
            Dim tlv As TypeLibVarAttribute = FieldAttributes(0)
            Dim flags As TypeLibVarFlags = tlv.Value
            Return (flags & TypeLibVarFlags.FHidden) > 0
        End If
        Return False
    End Function
End Module

注釈

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

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

コンストラクター

TypeLibVarAttribute(Int16)

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

TypeLibVarAttribute(TypeLibVarFlags)

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

プロパティ

TypeId

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

(継承元 Attribute)
Value

このフィールドの TypeLibVarFlags 値を取得します。

メソッド

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)

適用対象

こちらもご覧ください