TypeLibFuncAttribute Classe
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Contient les FUNCFLAGS qui ont été importées à l’origine pour cette méthode à partir de la bibliothèque de types COM.
public ref class TypeLibFuncAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
public sealed class TypeLibFuncAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeLibFuncAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
type TypeLibFuncAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Method, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeLibFuncAttribute = class
inherit Attribute
Public NotInheritable Class TypeLibFuncAttribute
Inherits Attribute
- Héritage
- Attributs
Exemples
L’exemple suivant montre comment obtenir la TypeLibFuncAttribute valeur d’une méthode.
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;
ref class ClassC
{
private:
static bool IsHiddenMethod( MethodInfo^ mi )
{
array<Object^>^MethodAttributes = mi->GetCustomAttributes( TypeLibFuncAttribute::typeid, true );
if ( MethodAttributes->Length > 0 )
{
TypeLibFuncAttribute^ tlf = dynamic_cast<TypeLibFuncAttribute^>(MethodAttributes[ 0 ]);
TypeLibFuncFlags flags = tlf->Value;
return (flags & TypeLibFuncFlags::FHidden) != (TypeLibFuncFlags)0;
}
return false;
}
};
using System.Reflection;
using System.Runtime.InteropServices;
namespace C
{
class ClassC
{
public static bool IsHiddenMethod(MethodInfo mi)
{
object[] MethodAttributes = mi.GetCustomAttributes(typeof(TypeLibFuncAttribute), true);
if (MethodAttributes.Length > 0)
{
TypeLibFuncAttribute tlf = (TypeLibFuncAttribute)MethodAttributes[0];
TypeLibFuncFlags flags = tlf.Value;
return (flags & TypeLibFuncFlags.FHidden) != 0;
}
return false;
}
}
}
Imports System.Reflection
Imports System.Runtime.InteropServices
Module C
Public Function IsHiddenMethod(ByVal mi As MethodInfo) As Boolean
Dim MethodAttributes As Object() = mi.GetCustomAttributes(GetType(TypeLibFuncAttribute), True)
If MethodAttributes.Length > 0 Then
Dim tlf As TypeLibFuncAttribute = MethodAttributes(0)
Dim flags As TypeLibFuncFlags = tlf.Value
Return (flags & TypeLibFuncFlags.FHidden) > 0
End If
Return False
End Function
End Module
Remarques
L 'Tlbimp.exe (Importateur de bibliothèque de types) applique cet attribut aux méthodes.
Cet attribut est appliqué lorsqu’une bibliothèque de types est importée et ne doit jamais être modifiée. Elle est appliquée uniquement lorsque la méthode FUNCFLAGS est évaluée à zéro. L’attribut est conçu pour être utilisé par les outils qui doivent savoir comment l’original FUNCFLAGS a été défini. Le Common Language Runtime n’utilise pas cet attribut.
Constructeurs
| Nom | Description |
|---|---|
| TypeLibFuncAttribute(Int16) |
Initialise une nouvelle instance de la |
| TypeLibFuncAttribute(TypeLibFuncFlags) |
Initialise une nouvelle instance de la |
Propriétés
| Nom | Description |
|---|---|
| TypeId |
En cas d’implémentation dans une classe dérivée, obtient un identificateur unique pour cette Attribute. (Hérité de Attribute) |
| Value |
Obtient la TypeLibFuncFlags valeur de cette méthode. |
Méthodes
| Nom | Description |
|---|---|
| Equals(Object) |
Retourne une valeur qui indique si cette instance est égale à un objet spécifié. (Hérité de Attribute) |
| GetHashCode() |
Retourne le code de hachage pour cette instance. (Hérité de Attribute) |
| GetType() |
Obtient la Type de l’instance actuelle. (Hérité de Object) |
| IsDefaultAttribute() |
En cas de substitution dans une classe dérivée, indique si la valeur de cette instance est la valeur par défaut de la classe dérivée. (Hérité de Attribute) |
| Match(Object) |
En cas de substitution dans une classe dérivée, retourne une valeur qui indique si cette instance est égale à un objet spécifié. (Hérité de Attribute) |
| MemberwiseClone() |
Crée une copie superficielle du Objectactuel. (Hérité de Object) |
| ToString() |
Retourne une chaîne qui représente l’objet actuel. (Hérité de Object) |
Implémentations d’interfaces explicites
| Nom | Description |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mappe un jeu de noms avec un jeu correspondant d'identificateurs de dispatch. (Hérité de Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Récupère les informations de type d’un objet, qui peuvent être utilisées pour obtenir les informations de type d’une interface. (Hérité de Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Récupère le nombre d'interfaces d'informations de type fourni par un objet (0 ou 1). (Hérité de Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fournit l’accès aux propriétés et méthodes exposées par un objet. (Hérité de Attribute) |