FeatureSupport.GetVersionPresent Metoda

Definicja

Pobiera wersję określonej funkcji, która jest dostępna w systemie.

Przeciążenia

GetVersionPresent(Object)

Po zastąpieniu w klasie pochodnej pobiera wersję określonej funkcji, która jest dostępna w systemie.

GetVersionPresent(String, String)

Pobiera wersję określonej funkcji, która jest dostępna w systemie.

GetVersionPresent(Object)

Po zastąpieniu w klasie pochodnej pobiera wersję określonej funkcji, która jest dostępna w systemie.

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

Parametry

feature
Object

Funkcja, której wersja jest żądana.

Zwraca

Reprezentujący Version numer wersji określonej funkcji dostępnej w systemie lub null jeśli ta funkcja nie jest zainstalowana.

Implementuje

Przykłady

W poniższym przykładzie kodu użyto OSFeature implementacji FeatureSupport funkcji i zapytań.LayeredWindows Wersja jest sprawdzana, aby sprawdzić, czy jest nullto , aby określić, czy funkcja jest obecna. Wynik jest wyświetlany w polu tekstowym. Ten kod wymaga textBox1 utworzenia i umieszczenia go w formularzu.

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

Uwagi

Numery wersji składają się z trzech części: głównej, pomocniczej i kompilacji. Zazwyczaj numer wersji jest wyświetlany jako "numer główny.numer pomocniczy.numer kompilacji".

Uwagi dotyczące implementowania

Gdy dziedziczysz z FeatureSupportklasy , należy zastąpić tę metodę. Po zastąpieniu tej metody sprawdź, czy klasa używana dla parametru feature jest taka sama jak klasa użyta dla tego parametru w metodzie IsPresent(String, String) . Jeśli dwa feature parametry różnią się, należy również zastąpić IsPresent(String, String)wartość .

Zobacz GetVersionPresent(Object) , aby zapoznać się z implementacją tej metody.

Zobacz też

Dotyczy

GetVersionPresent(String, String)

Pobiera wersję określonej funkcji, która jest dostępna w systemie.

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

Parametry

featureClassName
String

W pełni kwalifikowana nazwa klasy do wykonywania zapytań o informacje o określonej funkcji. Ta klasa musi implementować IFeatureSupport interfejs lub dziedziczyć z klasy, która implementuje ten interfejs.

featureConstName
String

W pełni kwalifikowana nazwa funkcji do wyszukania.

Zwraca

Element Version z numerem wersji określonej funkcji dostępnej w systemie lub null jeśli funkcja nie jest zainstalowana.

Uwagi

Numery wersji składają się z trzech części: głównej, pomocniczej i kompilacji. Zazwyczaj numer wersji jest wyświetlany jako "numer główny.numer pomocniczy.numer kompilacji".

Zapoznaj się z dokumentacją produktu zawierającego funkcję, aby określić nazwy, które mają być przekazywane do parametrów featureClassNamefeatureConstName i .

Zobacz też

Dotyczy