ExcelExtendWriteCSVT(Stream, ListT) Method

將物件寫入CSV文件

Definition

Namespace: eBizprise.Utility
Assembly: eBizprise.Utility.ExcelHelper (in eBizprise.Utility.ExcelHelper.dll) Version: 25.0.1.0+9af286275430f5cdff066120a88db0d7edbaef7c
C#
public static void WriteCSV<T>(
	this Stream stream,
	List<T> datas
)

Parameters

stream  Stream
資料流
datas  ListT
資料集

Type Parameters

T
物件

Return Value

bool

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Stream. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Example

C#
List<Employee> writeEmployees = new List<Employee>();
writeEmployees.Add(new Employee() { Account = "TestAccount1", EffectiveDate = DateTime.Now, EmployeeId = Guid.NewGuid(), EmployeeNo = "99999" });
writeEmployees.Add(new Employee() { Account = "TestAccount2", EffectiveDate = DateTime.Now, EmployeeId = Guid.NewGuid(), EmployeeNo = "99998" });

using (FileStream fileStream = new FileStream("ExcelHelperTest.xlsx", FileMode.OpenOrCreate))
    fileStream.WriteExcel(writeEmployees);

Revision History

DateVersionDescription
2020/02/071.0.0.0初版
2021/08/181.0.6.0調整CSV改以CsvHelper元件處理
2025/09/1925.0.0.0彙整2025年度初版

See Also