ObservableCollection Data to CSV - Helpme solve Bug

Em Andamento Postado há 6 anos Pago na entrega
Em Andamento Pago na entrega

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);

}

}

Programação C Engenharia Arquitetura de software Teste de Software

ID do Projeto: #16919168

Sobre o projeto

6 propostas Projeto remoto Ativo em há 6 anos

Concedido a:

MoustafaS

Hello, I am an expert in c# and I can fix this for you within minutes. Available to do it now. Regards

$100 USD em 1 dia
(19 Comentários)
4.8

6 freelancers estão ofertando em média $55 nesse trabalho

huongth

Hi. I am an expert in VBA, VBScript, Visual Basic, C#, F#, C, C++, ASM, Delphi, Java, iMacros, Flash, ASP, ASP.NET, Access, MySQL, MSSQL, QuickBooks, Oracle. I can create auto scripts to scrape websites, auto click, fo Mais

$30 USD em 1 dia
(17 Comentários)
4.2
jboo7

A proposal has not yet been provided

$30 USD em 1 dia
(24 Comentários)
4.4
gregorybliault

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

$35 USD em 1 dia
(7 Comentários)
2.8
$111 USD em 1 dia
(3 Comentários)
2.7