I have this array on a foreach loop:
StreamReader reader = new StreamReader(Txt_OrigemPath.Text);
reader.ReadLine().Skip(1);
string conteudo = reader.ReadLine();
string[] teste = conteudo.Split(new[] { '*' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string s in teste)
{
string oi = s;
}
The line i'm reading contains a few fields like matriculation, id, id_dependent, birthday ...
I have a CheckedListBox where the user selects wich fields he wants to select and what order he wants, according to this selection and knowing the order of each value in the array like(I know the first is matriculationthe second is id and the third is name), how could I select some of the fields, pass it's value to some variable and order them according to the checkedlistbox's order ? Hope I could be clear.
I tried this:
using (var reader = new StreamReader(Txt_OrigemPath.Text))
{
var campos = new List<Campos>();
reader.ReadLine();
while (!reader.EndOfStream)
{
string conteudo = reader.ReadLine();
string[] array = conteudo.Split(new[] { '*' }, StringSplitOptions.RemoveEmptyEntries);
var campo = new Campos
{
numero_carteira = array[0]
};
campos.Add(campo);
}
}
Now How may I run over the list and compare its values with those fields selected by the user from the checkedlistbox ?
Because if I instance the class again out the {} it's values will be empty...
Person p = new Person();
string hi = p.numero_carteira; // null.....
reader.ReadLine().Skip(1);does? Because it does bugger all.