Xamarin.Forms Guides | Samples

Xamarin.Forms.DependencyFetchTarget Enumeration

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


public enum DependencyFetchTarget


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

C# Example

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


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


Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions:,,,,,,

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

See Also: Enum

Public Fields

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