List<T>导出CSV
public static bool SaveListToCsv<T>(IList<T> lst, string filePath)
{
using (StreamWriter sw = new StreamWriter(filePath, false, Encoding.Unicode))
{
Type type = typeof(T);
PropertyInfo[] props = type.GetProperties();
// 生成列名
StringBuilder strColumn = new StringBuilder();
foreach (PropertyInfo item in props)
{
strColumn.Append(item.Name);
strColumn.Append("\t");
}
sw.WriteLine(strColumn);
// 写入数据
StringBuilder strValue = new StringBuilder();
foreach (var dr in lst)
{
strValue.Clear();
foreach (PropertyInfo item in props)
{
if (