【发布时间】:2020-03-29 00:05:28
【问题描述】:
我是 Xamarin 的新手。我正在关注一个教程,并且在那个
[assembly: Dependency(typeof())]
被使用了。我不明白这行代码的作用是什么。 请解释一下它的功能。
以下是代码。
[assembly: Dependency(typeof(SQLiteAndroid))]
namespace XamTestThree.Droid.Data {
public class SQLiteAndroid :ISQLite{
public SQLiteAndroid() { }
public SQLite.SQLiteConnection GetConnection()
{
var sqlLiteFileName = "TestDB.db3";
string documentPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
var path = Path.Combine(documentPath, sqlLiteFileName);
var conn = new SQLite.SQLiteConnection(path);
return conn;
}
}
}
【问题讨论】:
标签: c# android .net xamarin xamarin.forms