using (StreamReader sr = new StreamReader(fs)) { string barcode_data = sr.ReadToEnd().Replace("\r\n", ","); string[] Allbarcodes = barcode_data.Split(','); int counter = 0; for (int i = 0; i < Allbarcodes.Length - 1; i++) { if (!string.IsNullOrEmpty(Allbarcodes[i])) { long sumOfnum = Summation(Convert.ToInt64(Allbarcodes[i])); barcodeList.Add(sumOfnum + "," + Allbarcodes[i]); } } Array.Clear(Allbarcodes, 0, Allbarcodes.Length); label1.Text = counter++.ToString(); result = barcodeList.Select(m => new { value = int.Parse(m.Substring(0, m.IndexOf(','))), item = m }). OrderByDescending(m => m.value).Select(m => m.item).ToList(); ////list result contains all items and have to make sublists of it//// sr.Close(); sr.Dispose(); }
GroupBy
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)