FeatureSupport.GetVersionPresent Metodo

Definizione

Ottiene la versione della funzionalità specificata disponibile nel sistema.

Overload

GetVersionPresent(Object)

Quando sottoposto a override in una classe derivata, ottiene la versione della funzionalità specifica disponibile nel sistema.

GetVersionPresent(String, String)

Ottiene la versione della funzionalità specificata disponibile nel sistema.

GetVersionPresent(Object)

Quando sottoposto a override in una classe derivata, ottiene la versione della funzionalità specifica disponibile nel sistema.

public:
 abstract Version ^ GetVersionPresent(System::Object ^ feature);
public abstract Version GetVersionPresent (object feature);
public abstract Version? GetVersionPresent (object feature);
abstract member GetVersionPresent : obj -> Version
Public MustOverride Function GetVersionPresent (feature As Object) As Version

Parametri

feature
Object

Funzionalità di cui viene richiesta la versione.

Restituisce

Oggetto Version che rappresenta il numero di versione della funzionalità specificata disponibile nel sistema oppure null se la funzionalità non è installata.

Implementazioni

Esempio

Nell'esempio di codice seguente viene usata l'implementazione OSFeature di FeatureSupport e le query per la LayeredWindows funzionalità . La versione viene controllata per verificare se è null, per determinare se la funzionalità è presente. Il risultato viene visualizzato in una casella di testo. Questo codice richiede che textBox1 sia stato creato e inserito in un modulo.

private:
   void LayeredWindows()
   {
      // Gets the version of the layered windows feature.
      Version^ myVersion = OSFeature::Feature->GetVersionPresent(
         OSFeature::LayeredWindows );
      
      // Prints whether the feature is available.
      if ( myVersion != nullptr )
      {
         textBox1->Text = "Layered windows feature is installed.\n";
      }
      else
      {
         textBox1->Text = "Layered windows feature is not installed.\n";
      }

      
      // This is an alternate way to check whether a feature is present.
      if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) )
      {
         textBox1->Text = String::Concat( textBox1->Text,
            "Again, layered windows feature is installed." );
      }
      else
      {
         textBox1->Text = String::Concat( textBox1->Text,
            "Again, layered windows feature is not installed." );
      }
   }
private void LayeredWindows() {
   // Gets the version of the layered windows feature.
   Version myVersion = OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows);

   // Prints whether the feature is available.
   if (myVersion != null)
      textBox1.Text = "Layered windows feature is installed." + '\n';
   else
      textBox1.Text = "Layered windows feature is not installed." + '\n';

   // This is an alternate way to check whether a feature is present.
   if (OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
      textBox1.Text += "Again, layered windows feature is installed.";
   else
      textBox1.Text += "Again, layered windows feature is not installed.";
}
Private Sub LayeredWindows()
    ' Gets the version of the layered windows feature.
    Dim myVersion As Version = _
       OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows)
       
    ' Prints whether the feature is available.
    If (myVersion IsNot Nothing) Then
        textBox1.Text = "Layered windows feature is installed." & _
           ControlChars.CrLf
    Else
        textBox1.Text = "Layered windows feature is not installed." & _
           ControlChars.CrLf
    End If 
    'This is an alternate way to check whether a feature is present.
    If OSFeature.Feature.IsPresent(OSFeature.LayeredWindows) Then
        textBox1.Text &= "Again, layered windows feature is installed."
    Else
        textBox1.Text &= "Again, layered windows feature is not installed."
    End If
End Sub

Commenti

I numeri di versione sono costituiti da tre parti: principale, secondaria e build. In genere, un numero di versione viene visualizzato come "numero principale.numero minore.numero di build".

Note per gli implementatori

Quando si eredita da FeatureSupport, è necessario eseguire l'override di questo metodo. Quando si esegue l'override di questo metodo, verificare che la classe usata per il feature parametro corrisponda alla classe usata per questo parametro nel IsPresent(String, String) metodo . Se i due feature parametri sono diversi, è necessario eseguire anche l'override di IsPresent(String, String).

Vedere GetVersionPresent(Object) per un'implementazione di questo metodo.

Vedi anche

Si applica a

GetVersionPresent(String, String)

Ottiene la versione della funzionalità specificata disponibile nel sistema.

public:
 static Version ^ GetVersionPresent(System::String ^ featureClassName, System::String ^ featureConstName);
public static Version GetVersionPresent (string featureClassName, string featureConstName);
public static Version? GetVersionPresent (string featureClassName, string featureConstName);
static member GetVersionPresent : string * string -> Version
Public Shared Function GetVersionPresent (featureClassName As String, featureConstName As String) As Version

Parametri

featureClassName
String

Nome completo della classe cui richiedere informazioni sulla funzionalità specificata. È necessario che questa classe implementi l'interfaccia IFeatureSupport o erediti da una classe che la implementa.

featureConstName
String

Nome completo della funzionalità da ricercare.

Restituisce

Oggetto Version con il numero di versione della funzionalità specificata disponibile nel sistema oppure null se la funzionalità non è installata.

Commenti

I numeri di versione sono costituiti da tre parti: principale, secondaria e build. In genere, un numero di versione viene visualizzato come "numero principale.numero minore.numero di build".

Vedere la documentazione relativa al prodotto contenente la funzionalità per determinare i nomi da passare ai featureClassName parametri e featureConstName .

Vedi anche

Si applica a