【发布时间】:2017-10-13 01:44:40
【问题描述】:
我正在关注本教程在 Xamarin 中的 SQLite 实践:
https://code.tutsplus.com/tutorials/an-introduction-to-xamarinforms-and-sqlite--cms-23020
现在我被困在这里
公共随机思想数据库() { _connection = DependencyService.Get"ISQLite"().GetConnection(); }
ISQLite是PCL中的一个接口
它给出了这个错误
错误 CS0119 'DependencyService.Get(DependencyFetchTarget)' 是一种方法,在给定的上下文 LocalStorage 中无效
【问题讨论】:
-
您的意思是写
DependencyService.Get<ISQLite>()?你也碰巧有一个ISQLite.GetConnection属性,类似于this 问题吗? -
DependencyService.Get
().GetConnection();它有效。 -
一束感谢 :(
-
是的。实际上我是 Xamarin 的新手。从 Android Studio 转移到 Xamarin
标签: sqlite xamarin xamarin.forms