FeatureSupport.GetVersionPresent メソッド

定義

システムで使用できる指定された機能のバージョンを取得します。

オーバーロード

名前 説明
GetVersionPresent(Object)

派生クラスでオーバーライドされると、システムで使用できる指定された機能のバージョンを取得します。

GetVersionPresent(String, String)

システムで使用できる指定された機能のバージョンを取得します。

GetVersionPresent(Object)

ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs

派生クラスでオーバーライドされると、システムで使用できる指定された機能のバージョンを取得します。

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

パラメーター

feature
Object

バージョンが要求された機能。

返品

システムで使用可能な指定した機能のバージョン番号を表す Version 。機能がインストールされていない場合は null

実装

次のコード例では、OSFeature機能のFeatureSupportとクエリのLayeredWindows実装を使用します。 バージョンは、機能が存在するかどうかを判断するために、 nullされているかどうかを確認するためにチェックされます。 結果がテキスト ボックスに表示されます。 このコードでは、 textBox1 が作成され、フォームに配置されている必要があります。

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

注釈

バージョン番号は、メジャー、マイナー、ビルドの 3 つの部分で構成されます。 通常、バージョン番号は "major number.minor number.build number" と表示されます。

注意 (実装者)

FeatureSupportから継承する場合は、このメソッドをオーバーライドする必要があります。 このメソッドをオーバーライドする場合は、 feature パラメーターに使用するクラスが、 IsPresent(String, String) メソッドでこのパラメーターに使用されるクラスと同じであることを確認します。 2 つの feature パラメーターが異なる場合は、 IsPresent(String, String)もオーバーライドする必要があります。

このメソッドの実装については、 GetVersionPresent(Object) を参照してください。

こちらもご覧ください

適用対象

GetVersionPresent(String, String)

ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs
ソース:
FeatureSupport.cs

システムで使用できる指定された機能のバージョンを取得します。

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

パラメーター

featureClassName
String

指定した機能に関する情報を照会するクラスの完全修飾名。 このクラスは、 IFeatureSupport インターフェイスを実装するか、このインターフェイスを実装するクラスから継承する必要があります。

featureConstName
String

検索する機能の完全修飾名。

返品

システムで使用可能な指定された機能のバージョン番号を含む Version 。機能がインストールされていない場合は null

注釈

バージョン番号は、メジャー、マイナー、ビルドの 3 つの部分で構成されます。 通常、バージョン番号は "major number.minor number.build number" と表示されます。

機能を含む製品のドキュメントを参照して、 featureClassName に渡す名前と featureConstName パラメーターを決定します。

こちらもご覧ください

適用対象