【发布时间】:2012-01-25 16:24:16
【问题描述】:
我有 2 个 LINQ-to-SQL 列表,我使用以下方法将它们合并到 1 个列表中:
var mergedList = List1.Union(List2);
我假设 Union 命令将消除列表中的所有欺骗。那正确吗?无论如何,我正在尝试将合并列表的内容写入 csv 文件。当我尝试在以下位置调用列表时出现错误:
WriteToCSVFile cf = new WriteToCSVFile(mergedList);
这就是我构建班级的方式:
public WriteToCSVFile(IEnumerable<T> mergedList)
我在这里做错了什么?
顺便说一句,这是我得到的错误:
The type arguments for method 'WriteToCSVFile.WriteToCSVFile(System.Collections.Generic.IEnumerable<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly.
The type or namespace name 'T' could not be found (are you missing a using directive or an assembly reference?)
如果您需要更多信息,请告诉我。并提前致谢。
【问题讨论】:
标签: c# linq linq-to-sql join