Classe ComAliasNameAttribute
Dica
The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.
Indica o alias COM de um parâmetro ou tipo de campo.
Namespace: System.Runtime.InteropServices
Assembly: mscorlib (em mscorlib.dll)
Hierarquia de Herança
System.Object
System.Attribute
System.Runtime.InteropServices.ComAliasNameAttribute
Sintaxe
[AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue,
Inherited = false)]
[ComVisibleAttribute(true)]
public sealed class ComAliasNameAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Property | AttributeTargets::Field | AttributeTargets::Parameter | AttributeTargets::ReturnValue,
Inherited = false)]
[ComVisibleAttribute(true)]
public ref class ComAliasNameAttribute sealed : Attribute
[<Sealed>]
[<AttributeUsageAttribute(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue,
Inherited = false)>]
[<ComVisibleAttribute(true)>]
type ComAliasNameAttribute =
class
inherit Attribute
end
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field Or AttributeTargets.Parameter Or AttributeTargets.ReturnValue,
Inherited := False)>
<ComVisibleAttribute(True)>
Public NotInheritable Class ComAliasNameAttribute
Inherits Attribute
Construtores
Nome | Descrição | |
---|---|---|
ComAliasNameAttribute(String) | Inicializa uma nova instância da classe ComAliasNameAttribute com o alias do parâmetro ou do campo atribuído. |
Propriedades
Nome | Descrição | |
---|---|---|
TypeId | Quando implementado em uma classe derivada, obtém um identificador exclusivo para este Attribute.(Herdado de Attribute.) |
|
Value | Obtém o alias do campo ou do parâmetro, como encontrado na biblioteca de tipos quando ela foi importada. |
Métodos
Nome | Descrição | |
---|---|---|
Equals(Object) | Esta API dá suporte à infraestrutura produto e não se destina a ser usada diretamente do seu código. Retorna um valor que indica se essa instância é igual a um objeto especificado.(Herdado de Attribute.) |
|
GetHashCode() | Retorna o código hash para essa instância.(Herdado de Attribute.) |
|
GetType() | ||
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.) |
|
ToString() | Retorna uma cadeia de caracteres que representa o objeto atual.(Herdado de Object.) |
Implementações Explícitas da Interface
Nome | Descrição | |
---|---|---|
_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.) |
Comentários
Você pode aplicar esse atributo para parâmetros, campos, propriedades ou valores de retorno.
Exemplos
Na biblioteca de tipos a seguir, OLE_COLOR é um alias para int. Durante a importação, os argumentos do Color acessador são marcados com o ComAliasNameAttribute para indicar a essa biblioteca de tipo refere-se a eles como OLE_COLOR.
typedef int OLE_COLOR;
interface Baz {
HRESULT SetColor([in] OLE_COLOR cl);
HRESULT GetColor([out, retval] OLE_COLOR *cl);
}
são importados como:
interface Baz {
void SetColor([ComAliasName("stdole.OLE_COLOR")] int cl);
[return: ComAliasName("stdole.OLE_COLOR")] int GetColor();
}
Interface Baz
Sub SetColor( <ComAliasName("stdole.OLE_COLOR")> cl As Integer)
Function GetColor() As <ComAliasName("stdole.OLE_COLOR")> Integer
End Interface
interface class Baz
{
void SetColor( [ComAliasName("stdole.OLE_COLOR")]int cl );
[returnvalue:ComAliasName("stdole.OLE_COLOR")]
int GetColor();
};
Informações de Versão
.NET Framework
Disponível desde 1.1
Acesso thread-safe
Quaisquer membros estáticos públicos ( Compartilhado no Visual Basic) desse tipo são thread-safe. Não há garantia de que qualquer membro de instância seja thread-safe.
Confira Também
Namespace System.Runtime.InteropServices
Retornar ao início