Guest User

Untitled

a guest
Jun 19th, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             List<IntelHexModel> arr = new List<IntelHexModel>();
  13.  
  14.             arr.Add(new IntelHexModel() { RealAddress = 5 });
  15.             arr.Add(new IntelHexModel() { RealAddress = 4 });
  16.             arr.Add(new IntelHexModel() { RealAddress = 3 });
  17.  
  18.             List<IntelHexModel> arr2 = new List<IntelHexModel>();
  19.  
  20.             arr2.Add(new IntelHexModel() { RealAddress = 7 });
  21.             arr2.Add(new IntelHexModel() { RealAddress = 15 });
  22.             arr2.Add(new IntelHexModel() { RealAddress = 1 });
  23.  
  24.             List<IntelHexModel> arr3 = new List<IntelHexModel>();
  25.  
  26.             arr3.Add(new IntelHexModel() { RealAddress = 123 });
  27.             arr3.Add(new IntelHexModel() { RealAddress = 2 });
  28.             arr3.Add(new IntelHexModel() { RealAddress = 6 });
  29.             arr3.Add(new IntelHexModel() { RealAddress = 66 });
  30.  
  31.             List<List<IntelHexModel>> test = new List<List<IntelHexModel>>();
  32.  
  33.             test.Add(arr);
  34.             test.Add(arr2);
  35.             test.Add(arr3);
  36.  
  37.             var orderd = (from subList in test
  38.                           from subsubArr in subList
  39.                           orderby subsubArr.RealAddress
  40.                           group subsubArr by subList into ret
  41.                           select ret.ToList()).ToList();
  42.         }
  43.     }
  44.  
  45.     class IntelHexModel
  46.     {
  47.         public int RealAddress { get; set; }
  48.     }
  49. }
Add Comment
Please, Sign In to add comment