【发布时间】:2018-02-14 08:34:46
【问题描述】:
我想将要保存为 csv 的列表的结果保存到编码为 UTF 的变量路径中。
但是当我用 foreach 在我的列表上循环时:
foreach (String item in finalausgabe)
{
Console.WriteLine(ausgabe.GetType());
}
我在控制台中得到以下结果(仅前五行用于预览)
System.Collections.Generic.List1[System.String]
System.Collections.Generic.List1[System.String]
System.Collections.Generic.List1[System.String]
System.Collections.Generic.List1[System.String]
System.Collections.Generic.List1[System.String]
但我的列表实际上是这样的:
“状态”“用户ID”“用户名”“Vorname”“Nachname”“Zweiter Vorname”
“活跃” “1” “testm” “测试” “M” “” “M” “” “Kuhnkies”
“活跃” “10” “lext” Sofia Daasch “” “F” “” “Lex”
“活跃”“102”“瑞特”安娜·达巴格“”“M”“”“瑞特”
“活跃” “103” “buchmeiera” Lea Dabbert “” “M” “” “Buchmeier”
“活跃”“104”“fuchss”艾米莉亚达贝尔斯“”“M”“”
正如您所见,它已经准备好作为制表符分隔的 csv,只需将其逐行保存在编码为“utf-8”的 csv 文件中。
【问题讨论】:
-
你觉得
.GetType()是怎么回事 -
获取我的类型.. 知道了,但是 .GetValue() 不起作用..
标签: c# list csv generic-list