Generic class to CSV (all properties)

前端 未结 5 1176
梦如初夏
梦如初夏 2021-02-13 02:42

Im looking for a way to create CSV from all class instances.

What i want is that i could export ANY class (all of its instances) to CSV.

Can some1 direct me to p

5条回答
  •  暖寄归人
    2021-02-13 03:19

    You can use reflection to traverse all the class properties/fields and write them to CSV. A better approach would be to define a custom attribute and decorate the members you want to export and only export those attributes.

提交回复
热议问题