通用类为CSV(所有属性) [英] Generic class to CSV (all properties)

查看:155
本文介绍了通用类为CSV(所有属性)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来从所有类实例创建CSV。

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

我想要的是,我可以将ANY类(所有实例)导出为CSV。

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

可以some1指示我为这个可能的解决方案(如果已经anwsered)。

Can some1 direct me to possible solution for this (in case already anwsered).

thanx! p>

thanx !

推荐答案

其实,类似的东西已经在这里解决了:

Actually, something similar has been addressed here:

序列化对象的最佳做法到输出文件中使用的自定义字符串格式

这对您有用吗?

有一个示例使用反射来拉出字段名称和值,并将它们附加到字符串。

There is a sample that uses reflection to pull out the field names and values and append them to a string.

这篇关于通用类为CSV(所有属性)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆