Xamarin.Forms Guides | Samples

Xamarin.Forms.DependencyFetchTarget Enumeration

Enumeration specifying whether DependencyService.Get should return a reference to a global or new instance.

Syntax

public enum DependencyFetchTarget

Remarks

The following example shows how DependencyFetchTarget can be used to specify a new instance:

C# Example

var secondFetch = DependencyService.Get<IDependencyTest> (DependencyFetchTarget.NewInstance);

Members

Member NameDescription
GlobalInstanceReturn a global instance.
NewInstanceReturn a new instance.

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0

The members of Xamarin.Forms.DependencyFetchTarget are listed below.

See Also: Enum

Public Fields

GlobalInstanceDependencyFetchTarget. Return a global instance.
NewInstanceDependencyFetchTarget. Return a new instance.