Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

LINQ consult

$
0
0

Hello everybody,

I have the following file with these records:

Number ; Issue

01  ;  A 

02  ;  A

02  ;  B

02  ;  C

03  ;  G

I have created the following example code:

public class MyItem { public string Number{ get; set; } public string Issue{ get; set; } } public class MyData { private List<MyItem> gList; private string gFilePath ="\\...File.txt"; public void FillList() { IEnumerable<MyItem> gItems = from Line in File.ReadAllLines(gFilePath) let LineValues = Line.Split(';') select new MyItem() { Number = LineValues[0], Issue = LineValues[1] };

gList= gItems.ToList(); } }

I want to get the following result:

gList[0] { Number = "01", Issue = "A" }

gList[1] { Number = "02", Issue = "A-B-C" }

gList[2] { Number = "03", Issue = "G" }

Is it possible to do it, modifiying the part of LINQ code?

Thanks in advance and regards.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>