ComAliasNameAttribute Classe
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Indica o alias COM para um parâmetro ou tipo de campo.
public ref class ComAliasNameAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
public sealed class ComAliasNameAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ComAliasNameAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)>]
type ComAliasNameAttribute = class
inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ComAliasNameAttribute = class
inherit Attribute
Public NotInheritable Class ComAliasNameAttribute
Inherits Attribute
- Herança
- Atributos
Exemplos
Na seguinte biblioteca de tipos, OLE_COLOR existe um alias para int. Durante a importação, os argumentos do Color acessório são marcados com o ComAliasNameAttribute para indicar que a biblioteca de tipos se refere a eles como OLE_COLOR.
typedef int OLE_COLOR;
interface Baz {
HRESULT SetColor([in] OLE_COLOR cl);
HRESULT GetColor([out, retval] OLE_COLOR *cl);
}
é importado como:
interface class Baz
{
void SetColor( [ComAliasName("stdole.OLE_COLOR")]int cl );
[returnvalue:ComAliasName("stdole.OLE_COLOR")]
int GetColor();
};
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
Observações
Pode aplicar este atributo a parâmetros, campos, propriedades ou valores de retorno.
Construtores
| Name | Description |
|---|---|
| ComAliasNameAttribute(String) |
Inicializa uma nova instância da ComAliasNameAttribute classe com o alias do campo ou parâmetro atribuído. |
Propriedades
| Name | Description |
|---|---|
| TypeId |
Quando implementado numa classe derivada, obtém um identificador único para esta Attribute. (Herdado de Attribute) |
| Value |
Obtém o alias do campo ou parâmetro encontrado na biblioteca de tipos quando foi importado. |
Métodos
| Name | Description |
|---|---|
| Equals(Object) |
Devolve um valor que indica se esta instância é igual a um objeto especificado. (Herdado de Attribute) |
| GetHashCode() |
Devolve o código de hash para esta instância. (Herdado de Attribute) |
| GetType() |
Obtém o Type da instância atual. (Herdado de Object) |
| IsDefaultAttribute() |
Quando sobrescrito numa classe derivada, indica se o valor desta instância é o valor padrão para a classe derivada. (Herdado de Attribute) |
| Match(Object) |
Quando sobrescrito numa classe derivada, devolve um valor que indica se esta instância é igual a um objeto especificado. (Herdado de Attribute) |
| MemberwiseClone() |
Cria uma cópia superficial do atual Object. (Herdado de Object) |
| ToString() |
Devolve uma cadeia que representa o objeto atual. (Herdado de Object) |
Implementações de Interface Explícita
| Name | Description |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Mapeia um conjunto de nomes para um conjunto correspondente de identificadores de despacho. (Herdado de Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera a informação de tipo de um objeto, que pode ser usada para obter a informação de tipo para uma interface. (Herdado de Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Recupera o número de interfaces de informações de tipo que um objeto fornece (0 ou 1). (Herdado de Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Proporciona acesso a propriedades e métodos expostos por um objeto. (Herdado de Attribute) |