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

<ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Enum Or AttributeTargets.Interface, Inherited:=False)> _ Public NotInheritable Class TypeLibTypeAttribute Inherits Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Enum|AttributeTargets.Interface, Inherited=false)] public sealed class TypeLibTypeAttribute : Attribute
[ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Enum|AttributeTargets::Interface, Inherited=false)] public ref class TypeLibTypeAttribute sealed : public Attribute

タイプ ライブラリ インポータ (Tlbimp.exe) は、この属性をクラスまたはインターフェイスに適用します。
この属性はタイプ ライブラリがインポートされるときに適用され、変更されることはありません。適用されるのは、メソッドの TYPEFLAGS が 0 以外の場合だけです。この属性は、元の TYPEFLAGS がどのように設定されたかを把握する必要のあるツールが使用するために設計されています。共通言語ランタイムでは、この属性は使用されません。

クラスまたはインターフェイスの TypeLibTypeAttribute 値を取得する方法を次の例に示します。
Imports System 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
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; } } }
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; } };
import System.*; import System.Runtime.InteropServices.*; class ClassB { public static boolean IsHiddenInterface(Type InterfaceType) { Object interfaceAttributes[] = InterfaceType.GetCustomAttributes( TypeLibTypeAttribute.class.ToType(), false); if (interfaceAttributes.length > 0) { TypeLibTypeAttribute tlt = (TypeLibTypeAttribute)(interfaceAttributes.get_Item(0)); TypeLibTypeFlags flags = tlt.get_Value(); return (int)(flags & TypeLibTypeFlags.FHidden) != 0; } return false; } //IsHiddenInterface } //ClassB

System.Attribute
System.Runtime.InteropServices.TypeLibTypeAttribute


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


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