在xamarin.Android中将对象列表写入CSV文件

时间:2018-05-19 10:35:05

标签: xamarin.android

任何人都可以建议我如何在c#xamarin android中实现将对象List写入.csv到设备下载存储中。导出到csv的数据应该有header.each列表中的项应该写成行。类似于附加图片enter image description here

2 个答案:

答案 0 :(得分:0)

要创建CSV字符串,通常需要手动执行此操作。举个例子:

from google.cloud import bigquery client = bigquery.Client.from_service_account_json(credentials, project=project) dataset = client.get_dataset(client.dataset(dataset_name)) entries = list(dataset.access_entries) entry = bigquery.AccessEntry( role=role, entity_type=entity_type, entity_id=entity_id) entries.append(entry) dataset.access_entries = entries dataset = client.update_dataset(dataset, ['access_entries']) from google.cloud import bigquery client = bigquery.Client.from_service_account_json(credentials, project=project) dataset = client.dataset(dataset_name) dataset.reload() entries = list(dataset.access_grants) entry = bigquery.AccessGrant( role=role, entity_type=entity_type, entity_id=entity_id) entries.append(entry) dataset.access_grants = entries dataset.update()

...等...

然后将它们追加在一起,用换行符分隔。显然你在某种循环中做上述事情会更好。

至于将它放入android下载存储,其他人将不得不告诉你如何做到这一点,我不知道如何!

答案 1 :(得分:0)