I am having problems converting an object of products into a csv string.
var data = ProductPresenter.ExportAllProducts();
string csv = String.Join(",", data.Select(x => x.ToString()).ToArray());
This produces an output of:
BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts,BLL.Views.ExportAllProducts
Expected output would be like:
Small Hat, 12.10, true
Medium Hat, 13.50, true
Large Hat, 15.00, false
...
What conversion am I missing to get the values out of each item on the object?
.ToString()on a reference type just prints the name of the type. What is the type ofdata? Have you overridden the default behavior of.ToString()on it?