I'm having a method that takes a xml content from some file, parse it and after that putting some substrings into variables result and resultm. I want to write each value I got in result and resultm during foreach loops. Code that goes through all values and gets substrings looks like this:
var tipList = registers.Select(x => x.Attribute("type").Value);
var mapToList = registers.Select(x => x.Attribute("mapTo").Value);
foreach (var reg in registers)
{
foreach (var tpl in tipList)
{
var end = tpl.IndexOf(',');
var start = tpl.LastIndexOf('.', (end == -1 ? tpl.Length - 1 : end)) + 1;
var result = tpl.Substring(start, (end == -1 ? tpl.Length : end) - start);
}
foreach (var mpl in mapToList)
{
var endm = mpl.IndexOf(',');
var startm = mpl.LastIndexOf('.', (endm == -1 ? mpl.Length - 1 : endm)) + 1;
var resultm = mpl.Substring(startm, (endm == -1 ? mpl.Length : endm) - startm);
}
}
Can anyone help me with an idea how to add values of result and resultm strings in some DataGrid in C#?