TargetFrameworkAttribute Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Identifica la versione di .NET in base alla quale è stato compilato un particolare assembly.
public ref class TargetFrameworkAttribute sealed : Attribute
[System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)]
public sealed class TargetFrameworkAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Assembly, AllowMultiple=false, Inherited=false)>]
type TargetFrameworkAttribute = class
inherit Attribute
Public NotInheritable Class TargetFrameworkAttribute
Inherits Attribute
- Ereditarietà
- Attributi
Commenti
La TargetFrameworkAttribute classe fornisce un attributo che è possibile applicare a un assembly per indicare la versione del runtime .NET su cui è stato compilato l'assembly. Ad esempio, l'esempio seguente applica a TargetFrameworkAttribute un assembly per indicare che è stato compilato con .NET Framework 4.
using System;
using System.Runtime.Versioning;
[assembly:TargetFramework(".NETFramework,Version=v4.0")]
namespace MyCompany.Utilities
{
public class StringLibrary
{
// Members defined here.
}
}
Imports System.Runtime.Versioning
<Assembly:TargetFramework(".NETFramework,Version=v4.0)")>
Namespace MyCompany.Utilities
Public Class StringLibrary
' Members defined here.
End Class
End Namespace
Il TargetFrameworkAttribute costruttore della classe ha un singolo parametro, frameworkName, che specifica la versione .NET in cui è stato compilato l'assembly. Questo parametro esegue il mapping alla FrameworkName proprietà . Inoltre, l'attributo TargetFrameworkAttribute può specificare una proprietà per fornire una FrameworkDisplayName stringa di versione .NET più descrittiva adatta per la visualizzazione ai client dell'assembly. Nell'esempio seguente viene applicato a TargetFrameworkAttribute un assembly e vengono assegnati entrambi i valori delle proprietà per indicare che l'assembly è stato compilato usando .NET Framework 4.
using System;
using System.Runtime.Versioning;
[assembly:TargetFramework(".NETFramework,Version=v4.0",
FrameworkDisplayName = ".NET Framework, Version 4.0")]
namespace MyCompany.Utilities
{
public class StringLibrary
{
// Members defined here.
}
}
Imports System.Runtime.Versioning
<Assembly:TargetFramework(".NETFramework,Version=v4.0)", _
FrameworkDisplayName := ".NET Framework, Version 4.0")>
Namespace MyCompany.Utilities
Public Class StringLibrary
' Members defined here.
End Class
End Namespace
Costruttori
| Nome | Descrizione |
|---|---|
| TargetFrameworkAttribute(String) |
Inizializza un'istanza della TargetFrameworkAttribute classe specificando la versione .NET in cui è stato compilato un assembly. |
Proprietà
| Nome | Descrizione |
|---|---|
| FrameworkDisplayName |
Ottiene il nome visualizzato della versione .NET in base alla quale è stato compilato un assembly. |
| FrameworkName |
Ottiene il nome della versione .NET in base alla quale è stato compilato un particolare assembly. |
| TypeId |
Se implementato in una classe derivata, ottiene un identificatore univoco per questo Attribute. (Ereditato da Attribute) |
Metodi
| Nome | Descrizione |
|---|---|
| Equals(Object) |
Restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
| GetHashCode() |
Restituisce il codice hash per questa istanza. (Ereditato da Attribute) |
| GetType() |
Ottiene il Type dell'istanza corrente. (Ereditato da Object) |
| IsDefaultAttribute() |
Quando sottoposto a override in una classe derivata, indica se il valore di questa istanza è il valore predefinito per la classe derivata. (Ereditato da Attribute) |
| Match(Object) |
Quando sottoposto a override in una classe derivata, restituisce un valore che indica se questa istanza è uguale a un oggetto specificato. (Ereditato da Attribute) |
| MemberwiseClone() |
Crea una copia superficiale del Objectcorrente. (Ereditato da Object) |
| ToString() |
Restituisce una stringa che rappresenta l'oggetto corrente. (Ereditato da Object) |
Implementazioni dell'interfaccia esplicita
| Nome | Descrizione |
|---|---|
| _Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr) |
Esegue il mapping di un set di nomi a un set corrispondente di ID dispatch. (Ereditato da Attribute) |
| _Attribute.GetTypeInfo(UInt32, UInt32, IntPtr) |
Recupera le informazioni sul tipo per un oggetto, che può essere utilizzato per ottenere le informazioni sul tipo per un'interfaccia. (Ereditato da Attribute) |
| _Attribute.GetTypeInfoCount(UInt32) |
Recupera il numero delle interfacce di informazioni sul tipo fornite da un oggetto (0 o 1). (Ereditato da Attribute) |
| _Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr) |
Fornisce l'accesso alle proprietà e ai metodi esposti da un oggetto . (Ereditato da Attribute) |