Reputation: 164
I am following this tutorial for SQLite practice in Xamarin:
https://code.tutsplus.com/tutorials/an-introduction-to-xamarinforms-and-sqlite--cms-23020
Now I am stuck here in
public RandomThoughtDatabase () { _connection = DependencyService.Get"ISQLite" ().GetConnection (); }
ISQLite
is an interface in PCL
its giving this error
Error CS0119 'DependencyService.Get(DependencyFetchTarget)' is a method, which is not valid in the given context LocalStorage
Upvotes: 0
Views: 398
Reputation: 11105
Use the following instead:
public RandomThoughtDatabase () { _connection = DependencyService.Get<ISQLite>().GetConnection(); }
Upvotes: 2