ObservableCollection Data to CSV - Helpme solve Bug
$10-30 USD
货到付款
I'm using an ObservableCollection in my application; and I export that data to CSV. The export function works well ONLY the first time I export the data. The second time I export the data, the columns get different - but still exports.
I need you to fix that bug, and help export all the data in the collection in the same order the columns are originally.
Sample Code:
public static IEnumerable<string> ToCsv<T>(IEnumerable<T> list)
{
var fields = typeof(T).GetFields();
var properties = typeof(T).GetProperties().OrderBy(p=> "Time");
foreach (var @object in list)
{
yield return [url removed, login to view](",",
[url removed, login to view](x => ([url removed, login to view](@object) ?? [url removed, login to view]).ToString())
.Concat([url removed, login to view](p => ([url removed, login to view](@object, null) ?? [url removed, login to view]).ToString()))
.ToArray());
}
}
When I click Export Button:
using (var textWriter = [url removed, login to view](fileName))
{
string header = "Header Title Here"
[url removed, login to view](header);
foreach (var line in ToCsv([url removed, login to view] as ObservableCollection<[url removed, login to view]>))
{
[url removed, login to view](line);
}
}
项目ID: #16919168
关于项目
授予:
Hello, I am an expert in c# and I can fix this for you within minutes. Available to do it now. Regards
有6名威客正在参与此工作的竞标,均价$55/小时
Can I see your code? I may have an idea for this, I want to check something and if it is working I will let you know! Please contact me