Skip to content

Commit

Permalink
fix: 需要正确处理协变逆变问题,兼容.NET2.0。fix: #125
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Jul 6, 2023
1 parent 610e85a commit 9534457
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions NewLife.Core/IO/CsvDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void Write(IEnumerable<T> models, Boolean append)

var pis = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);

// 首次写入文件头
if (fs.Position == 0) csv.WriteLine(pis.Select(e => e.Name));
// 首次写入文件头。需要正确处理协变逆变问题,兼容.NET2.0
if (fs.Position == 0) csv.WriteLine(pis.Select(e => e.Name as Object));

// 写入数据
foreach (var item in models)
Expand Down

0 comments on commit 9534457

Please sign in to comment.