共用方式為


DependencyService.Resolve<T>(DependencyFetchTarget) Method

Definition

The method to use to resolve dependencies by type.

public static T Resolve<T> (Xamarin.Forms.DependencyFetchTarget fallbackFetchTarget = Xamarin.Forms.DependencyFetchTarget.GlobalInstance) where T : class;
static member Resolve : Xamarin.Forms.DependencyFetchTarget -> 'T (requires 'T : null)

Type Parameters

T

The type to resolve.

Parameters

fallbackFetchTarget
DependencyFetchTarget

The fetch target to use if fetching initially fails.

Returns

T

The resolved dependency instance.

Applies to