I'm trying to create a converter CSV to XML. The XML files might not have always the same number of fields, so i'm trying to get this number and then use it to create the elements
string[] source = new string[] { ligne };
XElement element = new XElement("DOCUMENT",
new XElement("GED",
from li in source
let champs = ligne.Split(';')
select new XElement("INDEX",
// where i'd like to put the loop code
new XElement(col[0], champs[0]),
new XElement(col[1], champs[1]),
new XElement(col[2], champs[2])... //etc,
)
)
);
//the code i'd like to put in the previous code
for (int i = 0; i < col.Length +1; i ++)
{
new XElement(col[i], champs[i]);
},