AssemblyDescriptionAttribute Classe

Definição

Fornece uma descrição em texto para uma assembleia.

public ref class AssemblyDescriptionAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
public sealed class AssemblyDescriptionAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)]
public sealed class AssemblyDescriptionAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class AssemblyDescriptionAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
type AssemblyDescriptionAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false)>]
type AssemblyDescriptionAttribute = class
    inherit Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, Inherited=false)>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type AssemblyDescriptionAttribute = class
    inherit Attribute
Public NotInheritable Class AssemblyDescriptionAttribute
Inherits Attribute
Herança
AssemblyDescriptionAttribute
Atributos

Exemplos

O exemplo de código seguinte define para AssemblyDescriptionAttribute uma assembly simples e indica se foi ou não definido.

using System;
using System.Reflection;

[assembly:AssemblyDescriptionAttribute("My Utility")]
public class Test {

    public static void Main()
    {
        //  Get the assembly.
        Assembly asm = Assembly.GetCallingAssembly();

        //  Verify that the description is applied.
        Type aType = typeof(AssemblyDescriptionAttribute);
        Console.WriteLine("Description applied: {0}",
            asm.IsDefined(aType, false));
    }
}
//  The output is:
//  Description Applied: True
Imports System.Reflection

<Assembly:AssemblyDescriptionAttribute("My Utility")> 

' Note: The suffix "Attribute" can be omitted:
' <Assembly:AssemblyTitle("A title example")>

Public Class Test
    Public Shared Sub Main()

        ' Get the assembly.
        Dim asm As [Assembly] = [Assembly].GetCallingAssembly

        ' Verify that the description is applied.
        Dim aType As Type = GetType(AssemblyDescriptionAttribute)

        Console.WriteLine("Description applied: {0}", _
            asm.IsDefined(aType, False))

    End Sub
End Class

' The output is:
' Description Applied: True

Observações

Quando cria um projeto em Microsoft Visual Studio 2005, este atributo é automaticamente aplicado com um valor de string vazio. Pode definir o seu valor em Visual Studio 2005 selecionando o Properties do projeto no menu File, e depois clicando em Assembly Information. O atributo está guardado no ficheiro AssemblyInfo do seu projeto, e deve ser removido antes de o poder especificar em código; caso contrário, receberá um erro a indicar que o atributo não pode ser aplicado várias vezes.

Quando clica com o botão direito no ficheiro assembly no Explorador de Ficheiros, este atributo aparece como o valor Comentários no separador Versão da caixa de diálogo de propriedades do ficheiro.

Construtores

Name Description
AssemblyDescriptionAttribute(String)

Inicializa uma nova instância da AssemblyDescriptionAttribute classe.

Propriedades

Name Description
Description

Obtém informação sobre a descrição da montagem.

TypeId

Quando implementado numa classe derivada, obtém um identificador único para esta Attribute.

(Herdado de Attribute)

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)

Aplica-se a

Ver também