Avatar of Paulagier
Paulagier
Flag for France

asked on 

C# Matching an item in a list with the corresponding item in a text file

Hello experts
C#
I have a List Lnodes with just one item per line: an int value  named "IdNumber"

I have a .txt file with two items per line:
- "IdNumber" (always the same lenght and position)
- a separator (;)
- "Position" (a string item with different length)

I need to read, line by line, the List Lnodes and,  for each value of IdNumber;
             - browse the .txt file
             - find the line that contains the same IdNumber value
             - extract on that line the corresponding "Position" string
             - Add that value to a row on another list

I'v tried a lot of methods (substrings, arrays, and so on) and now I'm lost !!
Hereunder are a sample of Lnodes and another of the .text file


List Lnodes

310
311
312
313
314
....



.txt file
310;UpSpine
311;LeftArm
312;LeftForeArm
313;LeftHand
314;MidSpine
315;RightForeArm
316;RightArm
317;Pelvis
C#.NET ProgrammingProgrammingASP.NET

Avatar of undefined
Last Comment
Paulagier

8/22/2022 - Mon