TypeLibFuncAttribute Classe

Definição

Contém o FUNCFLAGS que foi originalmente importado para esse método da biblioteca de tipos 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
Herança
TypeLibFuncAttribute
Atributos

Exemplos

O exemplo a seguir demonstra como obter o TypeLibFuncAttribute valor de um método.

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;
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

Comentários

O Tlbimp.exe (Importador de Biblioteca de Tipos) aplica esse atributo a métodos.

Esse atributo é aplicado quando uma biblioteca de tipos é importada e nunca deve ser alterada. Ela só é aplicada quando o método é FUNCFLAGS avaliado como não zero. O atributo foi projetado para ser usado por ferramentas que precisam saber como o original FUNCFLAGS foi definido. O common language runtime não usa esse atributo.

Construtores

TypeLibFuncAttribute(Int16)

Inicializa uma nova instância da classe TypeLibFuncAttribute com o valor TypeLibFuncFlags especificado.

TypeLibFuncAttribute(TypeLibFuncFlags)

Inicializa uma nova instância da classe TypeLibFuncAttribute com o valor TypeLibFuncFlags especificado.

Propriedades

TypeId

Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute.

(Herdado de Attribute)
Value

Obtém o valor TypeLibFuncFlags para este método.

Métodos

Equals(Object)

Retorna um valor que indica se essa instância é igual a um objeto especificado.

(Herdado de Attribute)
GetHashCode()

Retorna o código hash para a instância.

(Herdado de Attribute)
GetType()

Obtém o Type da instância atual.

(Herdado de Object)
IsDefaultAttribute()

Quando substituído em uma classe derivada, indica se o valor dessa instância é o valor padrão para a classe derivada.

(Herdado de Attribute)
Match(Object)

Quando substituído em uma classe derivada, retorna um valor que indica se essa instância é igual a um objeto especificado.

(Herdado de Attribute)
MemberwiseClone()

Cria uma cópia superficial do Object atual.

(Herdado de Object)
ToString()

Retorna uma cadeia de caracteres que representa o objeto atual.

(Herdado de Object)

Implantações explícitas de interface

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

Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de expedição.

(Herdado de Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

Recupera as informações de tipo para um objeto, que pode ser usado para obter as informações de tipo para uma interface.

(Herdado de Attribute)
_Attribute.GetTypeInfoCount(UInt32)

Retorna o número de interfaces de informações do tipo que um objeto fornece (0 ou 1).

(Herdado de Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

Fornece acesso a propriedades e métodos expostos por um objeto.

(Herdado de Attribute)

Aplica-se a

Confira também