TypeLibTypeAttribute Classe
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Contém os TYPEFLAGS que foram importados originalmente para esse tipo da biblioteca de tipos COM.
public ref class TypeLibTypeAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)]
public sealed class TypeLibTypeAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class TypeLibTypeAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)>]
type TypeLibTypeAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type TypeLibTypeAttribute = class
inherit Attribute
Public NotInheritable Class TypeLibTypeAttribute
Inherits Attribute
- Herança
- Atributos
Exemplos
O exemplo a seguir demonstra como obter o TypeLibTypeAttribute valor de uma classe ou interface.
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;
}
};
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;
}
}
}
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
Comentários
O Tlbimp.exe (Importador da Biblioteca de Tipos) aplica esse atributo a classes ou interfaces.
Esse atributo é aplicado quando uma biblioteca de tipos é importada e nunca deve ser alterada. Ele só é aplicado quando o método é TYPEFLAGS avaliado como diferente de zero. O atributo foi projetado para ser usado por ferramentas que precisam saber como o original TYPEFLAGS foi definido. O common language runtime não usa esse atributo.
Construtores
| Nome | Description |
|---|---|
| TypeLibTypeAttribute(Int16) |
Inicializa uma nova instância da |
| TypeLibTypeAttribute(TypeLibTypeFlags) |
Inicializa uma nova instância da |
Propriedades
| Nome | Description |
|---|---|
| TypeId |
Quando implementado em uma classe derivada, obtém um identificador exclusivo para esse Attribute. (Herdado de Attribute) |
| Value |
Obtém o TypeLibTypeFlags valor desse tipo. |
Métodos
| Nome | Description |
|---|---|
| Equals(Object) |
Retorna um valor que indica se essa instância é igual a um objeto especificado. (Herdado de Attribute) |
| GetHashCode() |
Devolve o código hash para esta 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 Objectatual. (Herdado de Object) |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual. (Herdado de Object) |
Implantações explícitas de interface
| Nome | Description |
|---|---|
| _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 de um objeto, que podem ser usadas para obter as informações de tipo de 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) |