TypeLibVarAttribute-Klasse
Enthält die ursprünglich aus der COM-Typbibliothek für dieses Feld importierten VARFLAGS.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<AttributeUsageAttribute(AttributeTargets.Field, Inherited:=False)> _
<ComVisibleAttribute(True)> _
Public NotInheritable Class TypeLibVarAttribute
Inherits Attribute
'Usage
Dim instance As TypeLibVarAttribute
[AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)]
[ComVisibleAttribute(true)]
public sealed class TypeLibVarAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Field, Inherited=false)]
[ComVisibleAttribute(true)]
public ref class TypeLibVarAttribute sealed : public Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Field, Inherited=false) */
/** @attribute ComVisibleAttribute(true) */
public final class TypeLibVarAttribute extends Attribute
AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)
ComVisibleAttribute(true)
public final class TypeLibVarAttribute extends Attribute
Hinweise
Type Library Importer-Tool (Tlbimp.exe) wendet dieses Attribut auf Felder an.
Das Attribut wird beim Importieren einer Typbibliothek angewendet und darf nicht geändert werden. Es wird nur angewendet, wenn die VARFLAGS der Methode als ungleich 0 ausgewertet werden. Dieses Attribut ist für Tools bestimmt, die die Festlegungen der ursprünglichen VARFLAGS kennen müssen. Von der Common Language Runtime wird dieses Attribut nicht verwendet.
Beispiel
Im folgenden Beispiel wird veranschaulicht, wie der TypeLibVarAttribute-Wert eines Felds abgerufen wird.
Imports System
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
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;
}
}
}
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;
}
};
import System.*;
import System.Reflection.*;
import System.Runtime.InteropServices.*;
class ClassD
{
public static boolean IsHiddenField(FieldInfo fi)
{
Object fieldAttributes[] =
fi.GetCustomAttributes(TypeLibVarAttribute.class.ToType(), true);
if (fieldAttributes.length > 0) {
TypeLibVarAttribute tlv = (TypeLibVarAttribute)fieldAttributes[0];
TypeLibVarFlags flags = tlv.get_Value();
return Convert.ToInt32(flags & TypeLibVarFlags.FHidden) != 0;
}
return false;
} //IsHiddenField
} //ClassD
Vererbungshierarchie
System.Object
System.Attribute
System.Runtime.InteropServices.TypeLibVarAttribute
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
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 unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
TypeLibVarAttribute-Member
System.Runtime.InteropServices-Namespace