Forum Xamarin.Forms

DependencyService Singleton

AlbertKAlbertK MYMember ✭✭✭✭

I would like to know how to declare dependencyservice as a singleton, Do I need to to this on very time I access the service or just declare it once on the App.xaml.cs or MainActivity.cs (android code)?

var serv = DependencyService.Get<MyClass>(DependencyFetchTarget.GlobalInstance);

Best Answer


Sign In or Register to comment.