【发布时间】:2017-12-15 13:03:11
【问题描述】:
我有一个主要用 C# 编写的 Xamarin 应用程序。 在 de app 中,我有一个 SQlite 数据库,其中存储了一个 Int (ID)、一个字符串和两个双精度数。
我需要元组列表中的字符串和两个双精度数。
虽然我知道如何将信息放入普通列表中,但我不知道如何将其放入元组中。
我如何填充普通列表:
protected override async void OnAppearing()
{
devListLoc.ItemsSource = await App.Database.GetAllLocations();
}
我如何在没有 SQlite 的情况下填充元组:
List list = new List<Tuple<string, double, double>>
{
new Tuple<string, double, double>("tesst1", 57.434180, 7.236162),
new Tuple<string, double, double>("test2", 58.435602, 8.234298),
};
所以我想以同样的方式填充元组列表,但我不知道如何,也无法在其他地方找到答案。
干杯!
编辑: GetAllLocations 任务:
public Task<List<BarLoc>> GetAllLocations()
{
return database.QueryAsync<BarLoc>("SELECT * FROM [BarLoc]");
}
【问题讨论】:
标签: c# list sqlite xamarin.forms tuples