次の方法で共有


HierarchyProvider.GetService(Type) メソッド

定義

要求したサービスを取得します。

protected:
 System::Object ^ GetService(Type ^ serviceType);
protected object GetService (Type serviceType);
member this.GetService : Type -> obj
Protected Function GetService (serviceType As Type) As Object

パラメーター

serviceType
Type

Type要求されたIServiceProviderインターフェイスの オブジェクト。

戻り値

要求されたサービス オブジェクト。または null サービスが存在しない場合は 。

実装

次の例では、 メソッドを GetService 使用してナビゲーション サービスを取得します。

bool OnMySelection() {

    INavigationService ns = (INavigationService)
        GetService(typeof(INavigationService));

    if (Parent.Properties == null)
        return false;

    ManagementConfigurationPath configPath =
        (ManagementConfigurationPath)Parent.Properties["ConfigurationPath"];

    return ns.Navigate(Connection, configPath,
        typeof(DemoPage), null);
} 

適用対象